question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

React Hooks misleading benchmark ?

See original GitHub issue

Iā€™ve been testing neverland against React, as itā€™s fully inspired by its hooks concept. However, if you remove the key={item.id} assignment from this row, to make it non-keyed, the benchmark runs fine only because the removed rows are decreasing, but never increasing.

If you just drop that key and you build-prod and try to remove twice the same row, or row 2 then row 4, youā€™ll have the whole benchmark/browser stuck forever because the logic is incapable to deal with such scenario.

Accordingly, since I believe React with hooks doesnā€™t require mandatory keyed transforms, and apologies if it does as I wasnā€™t aware of it, the current benchmark is misleading, as the same code, or similar up to the keyed point, cannot be used in non-keyed scenarios.

I am not sure this means React with hooks result should be invalidated, as it actually works well when keyed rows are used, but I think Iā€™ve found a glitch in this benchmark suite, as the removal of rows should rather be both for the previous row, but also for the row after, to bail out all frameworks incapable of dealing with real-world scenarios, instead of having facilitated only the ā€œdrop previous rowā€ one, which is currently the case.

Please let me know if youā€™d like me to file a PR that change the current row removal benchmark, or penalize keyed tests that wouldnā€™t work once non-keyed, or even ignore this issue, as considered not relevant for the current results.

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:27 (26 by maintainers)

github_iconTop GitHub Comments

1reaction
ryansolidcommented, Nov 20, 2019

@ryansolid if you look closer, hyperHTML is there and scores 100% from years ago ā€¦ so yes, Iā€™m aware of that, and all my libraries would easily deal with that test-case šŸ˜‰

Of course your work has been very influential on the Web Component side of things. I was just mentioning that many Virtual DOM libraries werenā€™t as good as they were today. Your libraries have always been at the forefront for Web Components in my mind and I have a lot of respect for your work. Which is why I was so curious about your thoughts on these nagging details of keyed/non-keyed.

1reaction
WebReflectioncommented, Nov 20, 2019

@krausest I still think having the change in the remove bench would help revealing other gotchas:

await testTextContains(driver, `//tbody/tr[6]/td[1]`, '11');
await clickElementByXPath(driver, `//tbody/tr[6]/td[3]/a/span[1]`);
await testTextContains(driver, `//tbody/tr[6]/td[1]`, '12');

it adds not much time to execute that test, but it helps understanding implementations

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid this React Hooks performance pitfall - Medium
You can see the difference that this makes by comparing the class component and the functional component with my benchmark tool. But classĀ ......
Read more >
Vue3 fixes everything that is wrong with React's hooks - Reddit
Instead you focus on one specific problem of hooks, that has not even been measured correctly. Your performance numbers of the React FAQ...
Read more >
A Critique of React Hooks - Hacker News
React team made the wrong separation of problems with hooks. ... hell (Angular) or veer off into performance-benchmark-overvaluing (Svelte).
Read more >
How To Avoid Performance Pitfalls in React with memo ...
By the end of this tutorial, you'll be familiar with many performance enhancing Hooks, such as the useMemo and useCallback Hook, and theĀ ......
Read more >
Optimizing Performance - React
If you're benchmarking or experiencing performance problems in your React apps, ... you can return false from shouldComponentUpdate instead, to skip theĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found