JS Conf JP

Sho Miyamoto

Working on {browser, server, edge}-side web development at newspaper company. Interested in performance, browser and standards.

https://github.com/antidotech https://twittercom/antidotech

Wrap-up: Runtime-friendly JavaScript

11/30/2019, 15:30 - 16:00
Room: B
Spoken language: ja

Let's wrap up what runtime-friendly performant JavaScript is like, introducing how runtime(such as v8, node.js etc.) handles scripts: Internal Representation, JIT, Eventloop etc. I will also mention tools(node options, chrome devtool) and the overhead of normal language feature(like object instantiation and Map/Set).

Plot (draft)

  • Fundamentals    - Runtime    - IR & JIT
  • Node    - Async & non-blocking I/O    - Stream    - Eventloop        - libuv
  • V8    - Crankshaft, FullCodeGen, TurboFun, Ignition
  • Internal Representation    - Object IR        - elements & properties        - Hidden Class        - JSON.parse    - String IR        - flatstr    - Array IR    - Number IR
  • JIT    - Hot code    - Inline Cache
  • Tools    - trace: opt, deopt, ic    - chrome devtool    - (d8)
  • Principle of high performance    - Application        - Maintainability is first            - Various people will join your team        - Choose performant libraries            - Core functionarities are run many times        - Use util library instead of your own ones            - tested            - performant            - used    - Library        - Low-overhead is nicer            - (TBD)
  • Techniques    - Avoid runtime overhead        - Object instantiation        - Map, Set, Object        - Regexp    - Avoid blocking I/O        - Sync, Async        - Macro/micro tasks    - PIFE/IIFE
  • Performant libraries    - bluebird    - ajv    - pico(nearForm)    - fastify(nearForm)
  • Appendix    - node-gyp    - quickjs, hermes