TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How to performance test React webapps for rendering speed regressions?

79 pointsby janci5243almost 6 years ago
As React webapps get large and start to contain a lot of complex components, they often do not perform well and manifest low FPS in browser. As a result, engineers add strategies such as memoization (React.memo, shouldComponentUpdate) to avoid unnecessary computation, however they logic is fragile to code changes.<p>Is there a way to automatically test performance (maybe in terms of FPS) of React applications regularly in CI pipelines? Any tools for this out there?

10 comments

iamleppertalmost 6 years ago
For frontend performance: record the frame rate (via requestAnimationFrame, look at simple frame rate counters), memory, count of DOM nodes on the page during each of your integration tests as a good start. You can get a lot of this via window.performance and memory info you need to pass an extra flag into chrome headless.<p>It’s also useful to instrument this in your production environment (called real user metrics) for some % of user sessions and combine it with more synthetic tests.<p>The backend is of course really easy, just measure request times (min&#x2F;avg&#x2F;max) and time to first byte.<p>Edit: Don’t know why I’m being downvoted for this answer? Lol
评论 #19970961 未加载
评论 #19972220 未加载
评论 #19971548 未加载
ejwesselalmost 6 years ago
I don&#x27;t do front end, but I asked my team and they linked me to:<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@paularmstrong&#x2F;twitter-lite-and-high-performance-react-progressive-web-apps-at-scale-d28a00e780a3" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@paularmstrong&#x2F;twitter-lite-and-high-perf...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;markerikson&#x2F;react-redux-links&#x2F;blob&#x2F;master&#x2F;react-performance.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;markerikson&#x2F;react-redux-links&#x2F;blob&#x2F;master...</a><p>Might be worth going through. Hopefully they&#x27;re useful.
评论 #19970873 未加载
jbaudanzaalmost 6 years ago
Before you spend time profiling a performance issue, make sure you&#x27;re using the production build of React. The development build is significantly slower. It sounds obvious, but I&#x27;ve made the mistake of trying to optimize performance issues that simply didn&#x27;t exist in production.
pspeter3almost 6 years ago
At Asana, we actually test performance in production with a A&#x2F;B test split. We use Interana (but any data aggregator would work) to analyze the results. Trying to measure the regressions in a sandbox did not match our Real User Metrics (RUM). In order for this to work though, you need to develop a strong mental model of React performance so you can optimize it further.
评论 #19970958 未加载
CallidaVorhisalmost 6 years ago
A few ideas:<p>- <a href="https:&#x2F;&#x2F;firebase.google.com&#x2F;docs&#x2F;perf-mon&#x2F;get-started-web" rel="nofollow">https:&#x2F;&#x2F;firebase.google.com&#x2F;docs&#x2F;perf-mon&#x2F;get-started-web</a> (this is a new feature released by Google. Luckily you don&#x27;t need Firebase to use this. <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KYYjdWSrRjI&amp;t" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KYYjdWSrRjI&amp;t</a> is a good tutorial on wiring your app up)<p>- <a href="https:&#x2F;&#x2F;reactjs.org&#x2F;docs&#x2F;perf.html" rel="nofollow">https:&#x2F;&#x2F;reactjs.org&#x2F;docs&#x2F;perf.html</a><p>- lighthouse by Google<p>You could just run lighthouse on your app periodically for an in depth audit on your site. That way you wouldn&#x27;t need to slow down your builds with a test (not sure what&#x27;s best practice here. Just trying to throw out some basic ideas)
mmckelvyalmost 6 years ago
&gt; As React webapps get large and start to contain a lot of complex components, they often do not perform well and manifest low FPS in browser.<p>Is this something you have actually experienced? Can you cite an example of running into this issue? I&#x27;ve built fairly complex UIs with React (tables with nested dropdowns, financial statements with a lot of data points, dynamic charts &#x2F; graphs, elements with animations, etc. and haven&#x27;t run into this issue.<p>The only time I&#x27;ve seen people have trouble w&#x2F; performance is when they use something like Redux or Apollo on top of React. The problem in those cases of course is Redux or Apollo, not React itself.
评论 #19973601 未加载
mychaelalmost 6 years ago
Many of the answers on this post are confusing web performance for rendering speed.
Equietalmost 6 years ago
Looking for the same. Ideally something that integrates well with Storybook or Testcafe.
catkinson19almost 6 years ago
WebdriverIO recently got support for Lighthouse, but also the devTools plungin has support for page load.<p>If I were to set this up I&#x27;d use devtools to throttle the network down to 3g, and I would actually render the browser in the test.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;webdriverio&#x2F;webdriverio&#x2F;tree&#x2F;master&#x2F;packages&#x2F;wdio-devtools-service&#x2F;src" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;webdriverio&#x2F;webdriverio&#x2F;tree&#x2F;master&#x2F;packa...</a>
econnorsalmost 6 years ago
A few resources I&#x27;ve found useful:<p>- lighthouse (<a href="https:&#x2F;&#x2F;github.com&#x2F;GoogleChrome&#x2F;lighthouse" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;GoogleChrome&#x2F;lighthouse</a>). You can implement this with their Node CLI to automate in your pipeline and output the results somewhere.<p>- calibre (<a href="https:&#x2F;&#x2F;calibreapp.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;calibreapp.com&#x2F;</a>). Gives you nice graphs and snapshots over time.