Live data from Hacker News

Rax – A universal React-compatible render engine

github.com

31–40 of 42 posts

Re: Rax – A universal React-compatible render engine

#31
post #9

Earlier quoted context omitted.

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).

Re: Rax – A universal React-compatible render engine

#32
post #9

Earlier quoted context omitted.

reading that, it seems pretty good. Are there performance costs to its diffing against the "real" DOM? 3kb for "React" is pretttttty tempting

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.

If you're loading libraries individually off a shared CDN, performance must not be much of a concern :P

Re: Rax – A universal React-compatible render engine

#33
post #24

Is it faster than Inferno[1]? [1] Inferno seems to be the fastest React drop-in replacement at 9kb size at the moment: http://stefankrause.net/js-frameworks-benchmark4/webdriver-t... - full post to the comparison table before: http://www.stefankrause.net/wp/?p=316

Those microbenchmarks are meaningless. If you choose a framework because of their microbenchmark grades you are making a huge mistake.

Yup, though the Rax benchmarks are especially bad. Calling a function with unchanging arguments in a loop with a constant number of iterations is going to trigger about the least real-world performance characteristics you could ask for, haha. I'm happy to see more people getting into the VDOM space, but it sucks to have to explain all the pitfalls every time a new broken benchmark comes out.

Re: Rax – A universal React-compatible render engine

#36
post #9

Earlier quoted context omitted.

reading that, it seems pretty good. Are there performance costs to its diffing against the "real" DOM? 3kb for "React" is pretttttty tempting

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.

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.

Re: Rax – A universal React-compatible render engine

#37
post #30

Earlier quoted context omitted.

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…

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.

Re: Rax – A universal React-compatible render engine

#38
post #10
post #8

their repo is full of slightly adapted other packages. If they are 100% React compat, why would they need rax-redux? :-S

On the surface, the rax-redux implementation appears to be a lot simpler. For example, react-redux's connect spans all these files https://github.com/reactjs/react-redux/tree/75658dab18f7fe3e... and includes "connectAdvanced": https://github.com/reactjs/react-redux/blob/75658dab18f7fe3e... While the rax-redux equivalent seems to be contained in a single file: https://github.com/alibaba/rax/blob/07e20908e4e17b182873db…

react-redux is definitely super bloated right now. It's packed full with method overloads (that are super confusing if you read their definitions in the doc as opposed to looking at examples), and performance optimizations that involve looking at the function arguments, memorization, etc.

It's cool and needed to cover all of the cases and edge cases, but it's easy to see how, if you don't need that stuff, it can be reimplemented in a fraction of the code.

Re: Rax – A universal React-compatible render engine

#40
post #10
post #8

their repo is full of slightly adapted other packages. If they are 100% React compat, why would they need rax-redux? :-S

On the surface, the rax-redux implementation appears to be a lot simpler. For example, react-redux's connect spans all these files https://github.com/reactjs/react-redux/tree/75658dab18f7fe3e... and includes "connectAdvanced": https://github.com/reactjs/react-redux/blob/75658dab18f7fe3e... While the rax-redux equivalent seems to be contained in a single file: https://github.com/alibaba/rax/blob/07e20908e4e17b182873db…

Looks like the Rax version is based on React-Redux 4.x, which was was primarily a single file and kept most of the logic in a React component. React-Redux v5 is a complete internal rewrite that pushes the logic out into memoized selector functions.

In fact, it appears to be 98%-ish the same as React-Redux v4.4.6. They've added semicolons, swapped out the React imports for Rax imports, and shuffled the order of some of the methods, but the code is effectively identical.

Post reply on HN