Skip to content

About Fre exact-updating(FEU) #120

@yisar

Description

@yisar

My English is not good, but I try to make a summary and explanation through this article.

What is?

Fre exact-updating(FEU) is a mechanism that make component rerender exact.

https://vuejs.org/v2/guide/comparison.html#Runtime-Performance

https://github.com/vuejs/vue-next/blob/9f52dce0d58f5bc09dded9291eadbb6b1af2dcbe/packages/runtime-core/src/renderer.ts#L871

Questions

  1. performance?

It's not an optimization, It's a different pursuit.

We shouldn't judge it by its performance. React doesn't have it, but its performance won't be very bad. As they say, repeated execution of JS is not worth money.

So I want to say that this mechanism is not about performance. It is to arrange whether the components are updated or not in the framework core.

  1. Can I use useMemo or react.memo or a HOC instead of it?

No.

I'm sorry, but I have to deny it.

This is the view of react all the time. The purpose of FEU is to arrange the update within the framework core, rather than solve the performance problems through other APIs.

I think react's top-down rendering mechanism was wrong from the beginning, especially in the framework of hooks APIs.

Changing it should be a framework, not developers.

  1. rules and limits?

To be honest, there are not many rules, and there will be no more mental overhead.

Just three rules

props with Shallow comparison

state with === comparison

deps with array comparison

As long as you are familiar with these three rules, you can reduce most repeated rendering.

  1. third party libraries?

This mechanism make most of the third-party libraries unusable.

We don't need to be compatible with react. It's a job that costs more money and does less work. Moreover, fre need to change its thinking and find different ways.

Todo

I'm happy that this mechanism will lead to discussion.

In fact, this is the most important mechanism of fre, because it is completely different from react. In the past, I have been plagiarizing from react, but from now on, fre has to go its own way.

Let's look forward to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions