Replies: 3 comments 5 replies
-
Generally speaking, diff algorithm has three levels. The first level, key map, is to put the key into a map and reuse the key as much as possible. The second level, preprocessing, directly skips the same head/tail, then key map for the other nodes. The third level is the longest increasing subsequence, after preprocessing, the remaining part first looks for the longest subsequence, they keep still and move other nodes. React is the first level, fre is the second, vue3 is the third. These three different levels of algorithm, editing distance is shorter and shorter, but not necessarily which is faster. The choice of algorithm is a trade-off, and the performance is determined by many factors, such as the limitation of fiber linked list, which leads to React can only use the simplest key map algorithm. Fre2 has managed to preprocess, but it can't use LIS now. I have an idea to do LIS on the linked list, but it needs to change the structure of the fiber linked list, which is a challenge, maybe fre3. |
Beta Was this translation helpful? Give feedback.
-
rephrase a bit: due to the hard limit of O(n) by the linked list data structure (no dual end comparison or LIS), React has a known performance issue in dealing with large set of collection. |
Beta Was this translation helpful? Give feedback.
-
Please discuss a little more details about the diff algorithm in React & Vue & Fre.
Beta Was this translation helpful? Give feedback.
All reactions