75 karma · joined Sep 19, 2014 (12y ago) · 61 submissions
comment 8y ago · link · parent
Inferno here is also slightly patched[1], instead of using stateless components, it is using stateful components to demonstrate how fast it can go down when you start using high-level abstractions in a library that focuses only on low-level primitives.
And if you really want to understand the fundamental flaw in libraries with fine-grained direct data bindings, try to reimplement this[2] 70 lines of React code with such library.
1. https://github.com/localvoid/js-framework-benchmark/commit/2...
2. https://github.com/localvoid/uibench-react/blob/master/js/fc...
comment 8y ago · link · parent
1. https://github.com/localvoid/js-framework-benchmark/commit/1...
2. http://rawgit.com/localvoid/js-framework-benchmark/sandbox/w...
comment 8y ago · link · parent
Maybe faster in basic microbenchmarks. As soon as you start optimizing UI library for complex applications, there are many other optimization goals you should focus on, like the size of the generated code per component type, the amount of different code paths(increase probability that executed code is JITed), etc.
Virtual DOM solves many issues, it is not just diffing, it is also a lightweight component model, possibility to add lightweight synthetic events, single code path for creating/updating/destroying DOM nodes, the simplest algo that handles complex tree transformations, etc.
comment 8y ago · link · parent
Until you actually start to implement gesture disambiguation and realize that pointer events are useless [1][2]
comment 8y ago · link · parent
Statements without any proof is more valuable than "benchmarks with zero information value"?
> what I mean is that compiled templates are usually much faster than doing vdom diffing
If they are usually much faster, why it is so hard to make them perform faster than vdom libraries in this benchmark? Or maybe any other benchmark, please just show me something that I can measure.
comment 8y ago · link · parent
I am wondering, how is it possible that such non-expensive algorithm is more expensive than many VDOM libraries in this benchmark[1] ?
1. https://rawgit.com/krausest/js-framework-benchmark/master/we...
comment 8y ago · link · parent
Have you tried to build a components library, or have you seen any component libraries that is built on top of a framework that doesn't provide lifecycle hooks for components? Something like https://ant.design/docs/react/introduce or https://developer.microsoft.com/en-us/fabric#/components
comment 8y ago · link · parent
Even if we pretend that other architectures doesn't have any memory overhead, vdom memory overhead in a large UI app will be less than a single small decoded image. But in reality, KVO can be way much more memory intensive, especially when we consider cases that involve filtering items in large collections.
comment 8y ago · link · parent
Surplus is fast because it doesn't have many features that available in many other libraries. For example, component model with lifecycles.
In this benchmark, "select row" should be the best case scenario for library like this, but even in such scenario it is slower than some vdom libraries.
comment 9y ago · link · parent
https://github.com/facebook/react/issues/3226
All other "static" optimizations doesn't make any noticeable difference in performance in highly optimized vdom libraries. In fact, they are usually decrease overall performance because of increased implementation complexity.
comment 9y ago · link · parent
I understand that they are doing it because of marketing reasons, because many people think that smaller means faster.
comment 9y ago · link · parent
I won't be able to write efficient vanilla code for something even slightly more complicated than this benchmark, and I wrote one of the fastest virtual dom implementations out there, so what you expect from an average web developer?
comment 9y ago · link · parent
comment 9y ago · link · parent
React apps are usually built with many layers of components that returns another components. And with standard Web API, there will be significantly more DOM nodes because each component is a DOM node.
comment 9y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
yes, almost by a factor of 4 :D
check out "render" test cases:
https://cdn.rawgit.com/localvoid/dd96890b82f1d1268df34330b14...
comment 10y ago · link · parent
When I've tried synthetic UI benchmarks, code with 100% type coverage on desktop machines had the same performance, on old mobile phones it was 0-10% faster(depends on the use case).
Minified code size with 100% type coverage were slightly smaller on small projects, but with the API for building UI Components that I've used, minified code with 100% type coverage should be significantly smaller on a large project.
comment 10y ago · link · parent
[0]: https://github.com/angular/tsickle
[1]: https://github.com/google/closure-compiler/wiki/Type-Based-P...
comment 10y ago · link · parent
All other libraries either don't have any form of recycling dom nodes, or it is disabled for this benchmark.
comment 10y ago · link · parent
The actual problem is how to efficiently traverse/modify DOM structure, in the end you'll just reimplement virtual dom.
comment 11y ago · link · parent
"React abstracts away the DOM from you, giving a simpler programming model and better performance" https://github.com/facebook/react
It seems strange to me that many developers are now trying to convince everyone that vdom wasn't selling as a way to get better performance. Yes, getting rid of data changes over time is important property of vdom approaches, but when all this vdom hype were started, everyone is also talked how awesome it is in terms of performance.
comment 11y ago · link · parent
>Is that argument correct? Is reading the DOM actually not so problematic, as long as the modification you make to it are minimal (which seems to be the strategy here)?
If you want to squeeze out as much "performance" as it is possible, most of the time you'd want to avoid reading DOM (even simple reads, not something that triggers render/layout)
And when it comes to minimal number of modifications, most popular libraries even fail on cases like "moveFromEndToStart or moveFromStartToEnd" (depends on the direction they traverse DOM), they will make N-1 moves.
But in the end all this numbers doesn't matter too much, React is fast enough for most use cases, its community and ecosystem is way more important than numbers in this benchmark.