• Front-end optimization has many dimensions, speaks point can be responsive side, because the browser thread of execution is single-threaded, determines that he can’t be competent for CPU intensive work, so how to solve the CPU intensive, how to better better CPU scheduling task, is a complex front-end applications that need to be solved in js scheduling scheme does not provide a clear, The various scheduling priorities depend on the internal implementation of the browser. The JS engine provides a queuing mechanism, but it depends on the runtime implementation of the browser to determine which IO tasks occupy CPU resources first.
  • Theoretically the user won’t browser do two things at the same time, but due to the browser to some other IO task execution and also in js to do in the main thread, lead to some user interaction behavior and browser behavior may exist concurrently, but due to a single thread, cannot be executed in parallel, in fact mononuclear alternately parallel also just grab the CPU, So how to design more appropriate tasks to slice, then alternating preempt the CPU and IO task, is also a lot of UI framework needs to be done, such as the react how much is the concept in the design, how to take apart the big task to the appropriate section of the task, the key lies in the context dependence, there must be a big task in above and below, How does it keep context when it disassemble into smaller slicing tasks? One way is through explicit tool calls, such as Task (user task) for explicit minimization of context dependency declaration, and the other way is through THE GENERATOR of ES6 for context passing.
  • Through the task of js slice, realized the line type of tasks, solving the context dependence between the different tasks, so you can rest assured the scheduling task to js engine, js, of course, a default scheduler won’t consider the browser IO task priority, this requires users to realize queuing mechanism in the application layer, Or rely on the browser’s underlying optimization and queuing for task encapsulation