r/javascript • u/nullvoxpopuli sand was never meant to think • Apr 27 '19
Ember is faster than React in certain benchmarks.
https://twitter.com/vaier/status/1121918769104871424?s=201
u/SL4M_DunkN Apr 27 '19
Any idea what's going on with the row swapping task times? I wouldn't expect preact to handle special cases better than react
1
u/nullvoxpopuli sand was never meant to think Apr 27 '19
could be differences in implementation of the benchmark, could be differences in preact and react themselves. hard to tell without diving into the source of each and narrowing down implementation differences
1
Apr 27 '19
Isn't the problem with current baseline op benchmarks that they fail to measure if an application is fast or slow? They're a minor or even meaningless factor. React in async/concurrent scheduler mode could potentially outperform all unscheduled frameworks because it balances load. Going forward we would need a different kind of benchmark that tests baseline and scheduling. As in, can framework xyz maintain 60fps if we bombard it with paint requests - and given that web apps only have a tiny margin of 15ms to expend, that shouldn't be hard to blow.
1
u/nullvoxpopuli sand was never meant to think Apr 27 '19
they fail to measure if an application is fast or slow? They're a minor or even meaningless factor
yeah, but these kinds of benchmarks are always thrown around when their tool is winning. When React is top, it's used, when Vue is top, it's used, etc. Most benchmarks out there not being a good representation of real applications is a real problem, but that's not to say that the problems benchmarks look at aren't going to happen in real apps.
Going forward we would need a different kind of benchmark that tests baseline and scheduling.
that'd be fantastic! do you know of any benchmarking collections that are trying this out?
5
u/lhorie Apr 27 '19
can framework xyz maintain 60fps if we bombard it with paint requests
I'd argue that a DOM framework is the wrong place to be handling FPS-sensitive stuff in the first place. You certainly wouldn't want to use React to handle the bulk of rendering in a graphics-intensive game, and for simple animations, plain CSS or dedicated libraries such as GSAP are surely better tools for the job. At my company, we have some seriously resource intensive UIs (in the order of millions of data points on screen) and React is only used as the glue to embed this system into other web-based systems, with the meat of the visualization being handled by GSLS.
React doesn't need fancy strategies to handle needle-in-the-haystack scenarios, just call setState in a small component and you get your localized update without blocking the main thread too much. If you do have a scenario where a very large portion of the UI is changing very quickly (like the sierspinski triangle demo), one ought to be asking themselves why they are using React as a hammer instead of considering another more suitable tool.
2
Apr 27 '19 edited Apr 27 '19
GSAP can maybe have 5-10 ms max per frame to compute, if your UI takes more than 15 ms for rendering, composition and paint the browser will consider blocking GSAP. That's why most (all?) web applications lag. Scheduling allows prioritized content, like your animation, to keep running as lower prioritized content won't go over budget. The sierpinsky triangle demo was misunderstood, they were merely simulating load.
React doesn't need fancy strategies to handle needle-in-the-haystack scenarios, just call setState in a small component and you get your localized update without blocking the main thread too much.
One component doesn't create a problem, but that's not our issue: https://youtu.be/nLF0n9SACd4?t=185
0
u/Guisseppi Apr 27 '19
in like 1 benchmark, maybe 2 against preact, even if the numbers were relevant, its still slow
5
u/nullvoxpopuli sand was never meant to think Apr 27 '19 edited Apr 27 '19
Ember is faster than React in:
- replace all rows
- swap rows
- remove row
React is faster than Ember in:
- create rows
- select row
- create many rows
- append rows to large table
They are pretty much the same in (through react *is* ahead):
- partial update
- clear rows
They used to be much further apart. So, maybe context is needed here for those who haven't been following the speed race.In the currently published benchmark: ember 3.3 vs react 16.4: https://stefankrause.net/js-frameworks-benchmark8/table.html
React wins by far in every benchmark except "select row".
So, this linked tweet, is more impactful when you have the context :)
0
Apr 27 '19
[deleted]
1
u/nullvoxpopuli sand was never meant to think Apr 27 '19
is there a project on github that implements that benchmark game in various technologies? I'd love to submit a PR :)
0
Apr 27 '19
[deleted]
1
u/nullvoxpopuli sand was never meant to think Apr 27 '19
the title says Computer Language -- so, my hunch is that it wouldn't be the same type of thing.
do you know of any other benchmark collections that are similar?
2
Apr 27 '19
[removed] — view removed comment
1
u/nullvoxpopuli sand was never meant to think Apr 27 '19
The key is in what you 'key' on. When I was messing with this benchmark in the ember 3.1 to 3.5 days, I think I did it wrong. But this person (who tweeted) found the most optimal thing to key on for this particular set of benchmarks. There has also been a lot of recent improvements to developer ergonomics (which affects developer speed positively)...
Seeing these benchmark updates showed me how important it is to check the keying options to make sure you've selected the right one for your use case.
7
u/AshenLordOfCinder Apr 27 '19
Isn't also fair to say that React is faster than Ember in certain benchmarks?