dillon1000/react
Commit
Browse files Simple updates using alternate fibers
This splits the Fiber type into Fiber and Instance. This could be two different object instances to save memory. However, to avoid GC thrash I merge them into one. When ReactChildFiber reconciles children, it clones the previous fiber. This creates a new tree for work-in-progress. The idea is that once flushed, this new tree will be used at the root. However, we know that we'll never need more than two trees at a time. Therefore my clone function stores the clone on the original. Effectively this creates a fiber pool. Ideally, the .alternate field shouldn't be used outside of clone so that everything can work with pure immutability. I cheat a bit for now so I don't have to pass both trees everywhere. ReactChildFiber is a bit hacky for reuse and doesn't solve all cases. Will fix that once I try to get parity.
Changed paths6 files
First-parent comparisonsrc/renderers/shared/fiber/ReactChildFiber.js ModifiedM src/renderers/shared/fiber/ReactFiber.js ModifiedM src/renderers/shared/fiber/ReactFiberBeginWork.js ModifiedM src/renderers/shared/fiber/ReactFiberCompleteWork.js ModifiedM src/renderers/shared/fiber/ReactFiberReconciler.js ModifiedM src/renderers/shared/fiber/__tests__/ReactIncremental-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…