reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
Eliraz 2020-05-19T09:46:12.483Z

Can reagent be faster than React ?

juhoteperi 2020-05-19T09:49:21.485200Z

@eliraz.kedmi157 There is some overhead on runtime Hiccup vectors etc. to React element conversion, but in application level immutable values (faster identity check for changed properties) and ratom/re-frame architecture can work to enable Reagent to call render less often and to move costly operations outside of render calls. Though well written React app could use the same optimizations.

juhoteperi 2020-05-19T09:50:49.486Z

This is very naive benchmark, just pure render performance.

Eliraz 2020-05-19T09:51:44.487Z

yes. it also didn't take the latest reagent version, nor the functional-compiler feature.

juhoteperi 2020-05-19T09:52:36.487900Z

there probably isn't much difference with latest version, and my very basic testing showed that functional compiler doesn't really affect performance

Eliraz 2020-05-19T09:57:58.490700Z

well, even on react's side moving to the functional (hooks) side didn't do much change in performance in idiomatic testings, however, working with hooks encourage you to utilize more DRY, thus making your app faster due to a better programming and not pure performance of the framework / library

Eliraz 2020-05-19T09:58:50.491500Z

I was hoping to see that reflects at those benchmarks you showed .

juhoteperi 2020-05-19T10:37:12.492200Z

Managing state with hooks works quite similar to what Reagent atoms/reactions and such already do.

juhoteperi 2020-05-19T10:37:49.493100Z

Btw. Reagent select-row implementation for that js-framework-benchmark was badly written, after fix it will probably match React.

Eliraz 2020-05-19T14:45:38.493600Z

oh good to know

Eliraz 2020-05-19T15:26:26.494200Z

what is router is recommended with reagent ?

v 2020-05-19T15:56:49.494300Z

Reitit

Eliraz 2020-05-19T15:58:23.494500Z

thank you, I was just looking at it

juhoteperi 2020-05-19T17:50:16.494700Z

Local benchmark run on my laptop with select-row optimization and function component version comparison. There is a bit more overhead on function components.

4🎉
juhoteperi 2020-05-19T17:50:40.495200Z

Select row is now even faster than React 🙂