NodeInteractve
October 4th, 2017

Live blog: Franziska Hinkelmann on Google, V8 and the future of Node.js

Franziska Hinkelmann is a compiler engineer on the v8 team at Google. This is a live blog. Doing the best I can to keep up and be accurate. Thanks for your understanding. — Tom

"What is node? It's AWESOME. That's the only joke you'll get in this 20 minutes."

Node.js is a JavaScript runtime, powered by v8, the same engine found in Chrome.

It provides asynchronous I/O, based on event loops.

100,000 lines of JS and C++ code, gluing v8 to server-side I/O and implementing Node modules.

And of course it is an ecosystem of open source packages (npm).

She works on the v8 engine, the JavaScript runtime [the engine that powers JavaScript]. They call it a compiler, a runtime, a virtual machine, etc.

Includes a just-in-time compiler (converts to very fast code on the fly) and performs speculative optimizations.

JavaScript source code is parsed and turned into an AST (Abstract Syntax Tree). Ignition compiles to bytecode, while TurboFan in the background compiled to optimized machine code. That includes speculative compilation to code that will be fast in certain situations; if the speculations are wrong it just runs the slightly slower bytecode.

v8 is written in C++ and implements the EcmaScript specification.

What v8 isn't:

It's not the I/O — it's not access to the filesystem. Those things are provided by libuv and Node.js itself.

It's not the DOM — that's provided by browsers themselves.

[It's just JavaScript itself in other words.]

Node is 1st Class Citizen in V8

"Node is a first class citizen in v8."

No v8 commit can land if it breaks node.

[I wonder how much Microsoft's efforts to promote alternative Node builds on their JavaScript engine have helped to drive this process? -Tom]

VM Diversity [aha!]

Node.js with different JavaScript engines. "There is no reason why the JavaScript engine that Node runs on must be v8. Microsoft has put a lot of effort into making Node.js run on ChakraCore [as found in] Edge. You can use different debugging features.

"Why am I happy that we're working on VM diversity when I work at Google? Why would I want to share the space? well it's not really counterintuitive. You get a much better product if you have competition. We saw this a few years ago with browsers. If we only had one we would never have the JavaScript performance that we have now. VM diversity is a good thing."

Porting native add-ons [think of the mongodb driver that is slightly faster if it can use C++] is a challenge for Node on different VMs. The new N-API makes it easy to use different engines.

 

 

img 20171004 095308054
Check out another article