I am Mathias Bynens. Ask me anything.

Mathias is a web standards fanatic from Belgium. He is currently working on the V8 JavaScript engine at Google. A great opportunity to ask him anything programming.

Ask Mathias Bynens about:

  • JavaScript
  • HTML
  • CSS
  • HTTP
  • performance
  • security
  • Bash
  • Unicode
  • macOS
  • OSS
  • …more
Ask a Question

41 discussions

Hi Mathias, What, according to you, should every beginner JavaScript programmer know about the V8 Engine?

Ideally, a beginning programmer knows absolutely nothing about any specific JavaScript engine. The number one thing to focus on is the JavaScript language. Read articles and books; follow interactive tutorials; start hacking on some hobby projects — whatever works best for you. But start with the language as a base, and keep an open mind. Learning about JavaScript engine internals as a beginning JS developer goes against that.

I’ll give you an example. V8 used to have a compilation pipeline called Crankshaft. For technical reasons, it didn’t do a great job of optimizing any code within try-catch blocks. This implementation detail caused some well-meaning developers to avoid try-catch altogether in their code “because otherwise it would be slow”, and instead work around the lack of proper error handling in complicated ways. Last year we shipped a new pipeline with TurboFan, our new optimizing compiler. try-catch can now be optimized in V8. All those hacky workarounds are now moot.

One can definitely gain valuable insights from studying a JavaScript engine. Heck, I’ve been doing this on a daily basis since last June :) But it’s important to recognize that optimizing for any specific engine doesn’t make much sense in the long-term. This applies to the Web platform with its diverse browser landscape, but to Node.js as well.

To optimize for performance across the board, i.e. in various JavaScript engines, learning about language details (e.g. by reading the spec) is far more valuable.

And there’s no reason you can’t do both! If you want to read about V8 internals while also learning something about JavaScript language details and getting performance tips that apply in all JS engines, check out my write-up on Elements Kinds, for example.

TL;DR Don’t jump through hoops trying to avoid a V8 implementation detail you once read about on Hacker News in 2011. Write idiomatic JavaScript code using modern language features. Focus on writing code that makes sense to you. That way, JavaScript engines across the board can focus on making it run fast for you.

Reply to this…

Hashnode is a friendly and inclusive dev community.
Come jump on the bandwagon!

  • 💬 Ask programming questions without being judged

  • 🧠 Stay in the loop and grow your knowledge

  • 🍕 More than 500K developers share programming wisdom here

  • ❤️ Support the growing dev community!

Create my profile

TC39 has been slowly expanding the standard JavaScript library (thank you!). Do you foresee a day where all the utilities in libraries like Lodash are just part of the built-in library?

By default, features that can be implemented in what the committee calls “userland code” don’t have a strong case to be included in the language. Exceptions can be made when implementing the feature natively would yield significant benefits compared to what’s possible in userland code:

  • deep platform integration (e.g. Promises)
  • performance or efficiency benefits in terms of load time, run time, or memory usage (e.g. RegExp Unicode property escapes, Intl features)
  • some features are impossible to implement in userland (e.g. WeakMap)

So far, this has always been discussed on a per-proposal basis. Bradley Farias and Daniel Ehrenberg are currently leading an effort to codify the TC39 committee’s goals on new proposals in general, which would help answer future-facing questions such as “should new library features be in built-in modules?”.

Part of the TC39 committee’s role is to act as a gatekeeper for the JavaScript language. The goal is not to maximize the number of features in the language, but rather to ensure that JavaScript continues to be an attractive language that’s as internally consistent as possible (within the constraints of backwards compatibility).

Reply to this…

How Google sees Blockchain? 💵

Reply to this…

What is your favourite emoji?

Asking the important questions!

U+1F618 FACE THROWING A KISS 😘 I like Apple’s rendition in particular.

Reply to this…

Would you rather fight 1 horse-sized duck or 100 duck-sized horses?

On January 1st, 2018, I embarked upon a spontaneous three-hour horse ride that changed everything. My white-maned friend’s name was Burro, and he took me on a wonderful tour through the beautiful Ibagué country fields. I had never ridden a horse before, and had such a good experience! It’s an afternoon I’ll never forget.

That night, I vowed to never fight Burro, or any other horse — especially not when they’re duck-sized.

I’m sorry, horse-sized duck. You’re going down.

Reply to this…

Load more responses