TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

radEventListener: Client-side Framework Performance

33 点作者 indysigners将近 5 年前

6 条评论

anonytrary将近 5 年前
Cool experiment, but what was learned? We already knew that:<p><pre><code> 1. Vanilla JS is faster than Preact&#x27;s diff&#x2F;render. 2. Preact&#x27;s diff&#x2F;render is faster than React&#x27;s. 3. Preact&#x27;s concurrency model is extremely weak&#x2F;non-existent. 4. Preact has worse third-party library support than React. 5. Preact is not that much smaller (min-gzip) than React 16. </code></pre> The conclusion is still the same: use React for UI, don&#x27;t bother with React-family libraries. Use vanilla JS for games, canvas, and other web APIs that aren&#x27;t UI.
评论 #24281581 未加载
评论 #24280274 未加载
jameskraus将近 5 年前
I&#x27;d love to know _why_ there is such a significant difference in performance between Preact and React here. It&#x27;s not like the React team doesn&#x27;t profile it. They must be optimizing for other features over this performance metric.
评论 #24279606 未加载
mnkypete将近 5 年前
You&#x27;d think that choosing a stack based on your target audiences computing needs would be more common.<p>Choosing React over vanilla JS is not only required for simple state things imho - for complex state I&#x27;d even say some may use something like Redux&#x2F;MobX. The development experience and speed vs vanilla JS is just unmatched. The amount you need to worry about adding &#x2F; removing classes, with implicit state all over the place will soon slow you down soon much because of all the edge cases you haven&#x27;t thought of.<p>I hope nobody starts off development for new apps in 2020 based on pure JS - even if you explicit target ultra-low-end devices, maybe try a lighter framework like preact (et al).
42droids将近 5 年前
In other news: if you walk around with weights attached to your body, you will walk slower.
brundolf将近 5 年前
This is a good article, but the HN title is highly editorialized. Can we get it changed?
评论 #24279602 未加载
ex3ndr将近 5 年前
preact is usually slower than react actually. Initial load may be slow, but not overall performance.<p>Also preact are very often simply not work, i can&#x27;t explain, but it is always something really creepy happening in random places. Event listeners also behave somehow different.<p>Also React 17 sets only a single listener to a document, not everywhere and adding a lot of listeners is much cheaper now.<p>At the same time most of the react slowness is not from react, but from awful libraries, usually css-in-js. And concept of css-in-js is actually very good, but implementations are simply awful.