DEV Community

Yisar
Yisar

Posted on

Fre is 10 times faster than react!

Recently, some people used react to find that rendering a large amount of data is particularly slow. They began to try fre and found that fre is 10 times faster on average than react!

Alt Text

Fre has been very fast. Frankly, I know react very well. I think the structure and algorithm used by the react team are not good enough within the framework, and they have not improved.

Let's look at the flame diagram.

react:

Alt Text

fre:

Alt Text

In this test, react defaults to synchronous mode and fre to concurrent mode, but in theory, the synchronous mode should be faster.

The time slice unit of fre is 16ms, which can finally be close to 60 FPS. There is an error in react. They think that the smaller the unit, the better, so that the unit of 5ms is too small and JS pressure is too high.

According to my experience, the advantage of vdom framework is that it has a better structure and can make better algorithms. Not only diff algorithms, but also offscreen algorithms.

But fre's algorithm is not the best. Maybe I will implement a better algorithm in fre3.

https://github.com/yisar/fre

If you are interested, you can see it.

Now I mainly do miniapps in the company. The rendering of miniapp uses fre.

Because this is a mobile architecture, I don't have much time to realize the fetures of PC side such as SSR, which is a pity.

Discussion (23)

Collapse
andresausecha profile image
Andres Ausecha Mosquera

Another JS library? Please everyday there are new. I do not even bother to read about them anymore

Collapse
132 profile image
Yisar Author

It's ok. fre has been a framework for three years, but I am in China and rarely promote it.

Collapse
jzombie profile image
jzombie

At least it's Fre

Collapse
mindplay profile image
Rasmus Schultz

He's been working on this for years - I've been following the development closely, because it's actually an interesting project, for two reasons:

  1. It reimplements the React API, but with functional components first and only - if that's all you need or want, trying this could be interesting.

  2. It uses a proper render scheduler - meaning, it does not block CSS animations etc. while rendering large chunks of content.

It's not really a "new library" in that sense - it's more in the category with Preact, an alternative React runtime. But it is substantially and fundamentally different from Preact, which could make it an interesting alternative for people building highly interactive applications where responsiveness is key - or perhaps just those who favor functional components and hooks, and want a smaller and faster runtime for some reason.

It might not be for you, personally - but this is not some random little "library of the hour", and it has substantially different qualities and goals from other alternative React runtimes.

You should not dismiss it so easily.

Collapse
132 profile image
Yisar Author

thank you! with my ♥

Collapse
ed1nh0 profile image
Edson Jr.

Rude. Instead you prefer to comment.

Collapse
132 profile image
Yisar Author

In fact, this is very few, I rarely comment abroad.

Thread Thread
ed1nh0 profile image
Edson Jr.

Sorry. I meant Andres Mosquera.

Collapse
andresausecha profile image
Andres Ausecha Mosquera • Edited on

I am sorry but I have been a pro JS developer for more than 5 years and this is becoming exhausting already, even I am already a JS specialist and everyday find new info and patterns.

Thread Thread
132 profile image
Yisar Author

It's okay, it's okay.

Collapse
kingleo10 profile image
Niroj Dahal

Agreed. Instead of creating new framework and library every month ,it would be better to improve existing ones out there.

Collapse
132 profile image
Yisar Author

The existing framework cannot be improved, because it involves the core algorithm, if it is not designed from the beginning, it will not be able to be modified later

Collapse
h8f1z profile image
Ahmed Hafiz

This is quite interesting.
Not just performance, according to GitHub repo: bundle size too.
Can you also write a comparison of features to other frameworks? (This looks so similar to react. Good thing for not having to learn yet another framework)

Collapse
132 profile image
Yisar Author
Collapse
andreidascalu profile image
Andrei Dascalu

It's not really a huge thing to be faster than React. It would be a huge thing to be faster than React and offer a compatible developer experience.
Svelte is also faster than React but I found it a bit more troublesome to try and use it to update a legacy webapp piece by piece.

Collapse
132 profile image
Yisar Author

Fre can provide the same mental model as React, but I can't be compatible with React.

Collapse
rangercoder99 profile image
RangerCoder99

Fre is also 1000% less popular

Collapse
132 profile image
Yisar Author

Yes yes, haha

Collapse
anupjoseph profile image
AnupJoseph

This does look very fast, and I liked that its almost the exact same API as React. Can you please add the way which the benchmark was calculated?

Collapse
132 profile image
Yisar Author
Collapse
anupjoseph profile image
AnupJoseph

Thanks

Collapse
nashequilibrium profile image
nashe-quilibrium • Edited on

我很开心看到这个projects I will save it now and see how I can help I'm not developer but I can invest with you if you are interested you can invite me in weixin : d-o999 and we can see what should be do

Collapse
132 profile image
Yisar Author

my weixin account is
shibuyayuri