From d70dbfdb658e9f77fafc78aead05e6053840f1c3 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Thu, 28 Feb 2019 13:46:36 -0800 Subject: [PATCH] Added intro to OVERVIEW --- OVERVIEW.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OVERVIEW.md b/OVERVIEW.md index 7594908486..aa60a29a12 100644 --- a/OVERVIEW.md +++ b/OVERVIEW.md @@ -1,5 +1,13 @@ # Overview +The React DevTools extension consists of multiple pieces: +* The "frontend" portion is the extension you see (the Elements tree, the Profiler, etc.). +* The "backend" portion is invisible. It runs in the same context as React itself. When React commits changes to e.g. the DOM, the backend is responsible for notifying the frontend by sending a message through the "bridge". + +One of the largest performance bottlenecks of the old React DevTools was the amount of bridge traffic that was sent. Each time React committed an update, the backend sent every fiber that changed across the bridge, resulting in a lot of (JSON) serialization. The primary goal for the DevTools rewrite was to reduce this traffic. Instead of sending everything across the bridge, the backend could only the minimum amount required to render the Elements tree– and the frontend could request more information (e.g. an element's props) on demand, only as needed. + +The old DevTools also rendered the entire application tree in the form of a large DOM structure of nested nodes. A secondary goal of the rewrite was to avoid rendering unnecessary nodes by using a windowing library (specifically [bvaughn/react-window](https://github.com/bvaughn/react-window)). + ## Serializing the tree Every React commit that changes the tree in a way DevTools cares about results in an "_operations_" message being sent across the bridge. These messages are lightweight patches that describe the changes that were made. (We don't resend the full tree structure like in legacy DevTools.)