Hacker News new | ask | show | jobs
by swrobel 3444 days ago
Interesting that they don't compare it to preact: https://github.com/developit/preact
3 comments

I thought the same. Their targets are Inferno and Preact.
I switched from React to react-lite for https://www.findlectures.com and it has worked great (haven't compared to Preact yet)
reading that, it seems pretty good. Are there performance costs to its diffing against the "real" DOM?

3kb for "React" is pretttttty tempting

Preact doesn't offer a full synthetic events system so handling e.g. touch events cross-browser may cause you a little more headache than it would in React.

But I'm currently using Preact (server-rendered) for my personal site and loving the speed and byte size.

FWIW, there is actually no code in React to normalize touch events between browsers. For touch events react and preact are basically the same (aside from React creating a lot of pooled objects for their synthetic event system, and preact not using delegation).
Forget about file size, 40kb vs 8kb doesn't really matter in the modern era. If anything, using an obscure library may cost you more because it's less likely to be a CDN cache hit for the user.
Start testing on a mid range Android device on 3G and tell me you still believe that.

On mobile it's not just the file transfer that takes time: it's the JavaScript parsing and execution (on a single core) that hurts too. iPhones are massively faster than Android (especially cheaper Androids) at this, so many developers don't realize how much performance cost there is for a growing majority of their users.

Given how many different versions there are of popular libraries I'm personally skeptical that CDNs give you much of a chance if the asset being preloaded from another site. I'd love to see real numbers on this though.

I build games where the player is supposed to play for hours. Am I wrong thinking that file size matters less for me? It adds 1% to the loading screen.
Yeah for games it's not much of an issue.

It becomes more of an issue if you are doing a "business" app, where there's a lot of moving between pages and a lot of eventual page refreshes.

we package our JS into one bundle, so just one CDN to hit (ours).

Another thing is that even if you're at 40kb gzipped, that's still at least 20ms for parsing JS. When you're trying to improve performance, chopping out 30kb is nice

You mean, in America... in a metropolitan area.... with a nice newer device... with an unlimited data plan. A 40kb vs 8kb savings can mean quite a bit to those in other conditions.
40kb is 40% of your budget if targeting mobile.
If you're loading libraries individually off a shared CDN, performance must not be much of a concern :P