runtime • However JavaScript is dynamic typed language • Optimized Code has some dynamic checks to validate assumptions. • If a dynamic check and a validation are failed, v8 deoptimized the code…
Y \B C^ GPS WBSJJJ Y \B C^ First, v8 runs the unoptimized code for gathering feedbacks. When the function is hot, V8 optimized the function V8 optimizes this x function 1. need to load a and b props 2. a and b value is `number` 3. sum a and b and return the value
Y \B C^ GPS WBSJJJ Y \B C^ Y \B٣খแ C^ First, v8 runs the unoptimized code for gathering feedbacks. When the function is hot, V8 optimized the function However JavaScript can take dynamic parameters. this {a: '٣খแ'} is not `number`
not `number` GVODUJPOY PCK \ SFUVSOPCKB PCKC ^ Y \B C^ Y \B C^ GPS WBSJJJ Y \B C^ Y \B٣খแ C^ First, v8 runs the unoptimized code for gathering feedbacks. When the function is hot, V8 optimized the function Oh… my optimization code has gone… need to go back to unoptimized code.
Y \B C^ GPS WBSJJJ Y \B C^ Y \BBJFFFFFF C^ First, v8 runs the unoptimized code for gathering feedbacks. When the function is hot, V8 optimized the function Oh… my optimization code has gone… need to be back to unoptimized code. However JavaScript can execute dynamic parameters. those parameters are changed `a` prop value to `string` %FPQUJNJ[BUJPO
rest/spread parameters • Don’t use try/catch or try/finally • Don’t use for-in • If JIT killer kills optimizer, goes down to terrible performance. Optimization Killer Do not support ES2015+ Deoptimization cost is high.
REST parameters • Don’t use try/catch or try/finally • Don’t use for-in • If JIT killer kills optimizer, goes down to terrible performance. Eliminate JIT killers Support ES2015+ Deoptimization cost is not so high. ✓ ✓ ✓ ✓ ✓ 4PMWFE
improvement the JavaScript Performance, Turbofan + Ignition is fast. • HTTP2 will solve Head of Line blocking, http network is more faster. • Future Node.js may support Worker. Worker can use CPU more efficiently.