V8 Blog
v8project.blogspot.com · Company blog · on HN since 2015
The V8 team at Google posts about the JavaScript engine's compilers, garbage collection, WebAssembly support, and release changes.
What HN saysHN links it for details on TurboFan and Ignition, such as try/catch now optimizing well, and for explanations of V8 behavior like Math.random().
98HN people shared it
53linked it in comments
93stories submitted
4.9Kstory points
8 years agolast shared
2015people per year2026
Most-shared posts
- 1Launching Ignition and TurboFan5 people · 110 points · first shared 2017 · 8 comments on HN
- 2There's Math.random(), and then there's Math.random()4 people · 232 points · first shared 2015 · 106 comments on HN
- 3V8 JavaScript Engine: Digging into the TurboFan JIT4 people · 69 points · first shared 2015 · 4 comments on HN
- 4Temporarily disabling escape analysis4 people · 5 points · first shared 2017 · discussion on HN
- 5V8 JavaScript Engine: “Elements Kinds” in V84 people · 4 points · first shared 2017 · discussion on HN
- 6WebAssembly Browser Preview3 people · 759 points · first shared 2016 · 338 comments on HN
- 7Experimental support for WebAssembly in V83 people · 394 points · first shared 2016 · 262 comments on HN
- 8ES6, ES7, and beyond3 people · 243 points · first shared 2016 · 73 comments on HN
- 9Optimizing hash tables: hiding the hash code3 people · 135 points · first shared 2018 · 70 comments on HN
- 10Improving DataView performance in V83 people · 85 points · first shared 2018 · 12 comments on HN
- 11V8: Firing Up the Ignition Interpreter3 people · 71 points · first shared 2016 · 18 comments on HN
- 12Orinoco: V8's new jank-reducing garbage collector3 people · 7 points · first shared 2016 · discussion on HN
- 13V8 release v6.43 people · 5 points · first shared 2017 · discussion on HN
- 14V8 release v6.62 people · 184 points · first shared 2018 · 72 comments on HN
- 15Fall cleaning: Optimizing V8 memory consumption2 people · 157 points · first shared 2016 · 39 comments on HN
What HN people wrote when they linked it
jbergstroem · 2016-10-25
Expect a blog post shortly, but from v8 we get these language changes:
- await/async behind flag (already covered in thread)
- Exponentiation operator:
> console.log(60**2*24);
86400
- Object.{values,entries}:
> o = { a: 1, b: 2}
> Object.values(o);
[ 1, 2 ]
- Object.getOwnPropertyDescriptor(s):
> o = { a: 1 }
> Object.getOwnPropertyDescriptors(o);
{ a: { value: 1, writable: true, enumerable: true, configurable: true } }
Additionally, there's a lot of pretty impressive optimization work done by the v8 team. You can read more about that on their blog: http://v8project.blogspot.com
Finally, one of my favorite things about Node.js 7.0 is the WhatWG http parser: https://github.com/nodejs/node/pull/7448.
edit: elaborated on exponentiation operator
littlestymaar · 2017-06-06
With the new optimizing compiler (Turbofan) landing, JavaScript `Exception` are now usable without significant performance penalty: great news !
A bit of context: v8 used to have troubles optimizing code which contained `try/catch` sections, which led to massive performance issues on hot parts of the code in Chrome and deterred a lot of people from using Exceptions in JavaScript (including node). Glad to see this bug finally fixed !
More infos on the new v8 stack here: https://v8project.blogspot.fr/2017/05/launching-ignition-and-turbofan.…
chmln · 2017-03-31
The new major version 8 of Node.js coming out in April will be a great performance booster for those who started using async/await and more:
- Node upgraded v8 to 5.7 [1] & async functions as fast as promises [2]
- Optimizations in fs[3]
[1] https://github.com/nodejs/node/pull/11752
[2] https://v8project.blogspot.ca/2017/02/v8-release-57.html
[3] https://github.com/nodejs/node/pull/12105
0xcoffee · 2016-12-04
Well Atom and VSCode are both electron based, but Atom already has a minimap-scrollbar implemented so it is possible.
https://atom.io/packages/minimap
Maybe it isn't as 'technically good', but it does the job and imo looks good. 3M+ downloads.
As for performance, they try to keep up with electron, which keeps up with Chrome, which is currently being retrofitted with a new blazing fast javascript engine (https://v8project.blogspot.com), so it will only get better :)
Zikes · 2016-01-08
And the followup: http://v8project.blogspot.com/2015/12/theres-mathrandom-and-then-there…
vanderZwan · 2018-01-30
This (and the older blog-post about backing stores[0]) are incredibly relevant to my LZ-string optimisations[1]. LZ-string takes an input string, builds a dictionary of substrings as it scans over the input, and outputs substring-tokens to a bit-stream, then converts that bit-stream into a new string.
How that dictionary is built is what is most relevant here: it is the greatest bottleneck in determining the speed of the algorithm. I have tried many variants. The ones that seem to work best match what is described here:
- instead of naively using sub-strings and dictionary lookup, build a trie[2] (putting all sub-strings in an object used as a flat dictionary quickly overflows the 1022-elements limit)
- instead of character strings, use charCodeAt[0] to use integer keys in the look-up of the trie (index with elements rather than hashcodes, and because JS strings are UTF16, the keys are SMI. It also removes string creation overhead).
- for a long time, I used one object for each node, with 0 as the key to look up its value, and charCode+1 to look up next nodes. In recent benchmarks it turned out that { v: val, d: {} } is faster[4][5][6]. This makes sense because: "we don't store information about present indexed properties on the HiddenClass" [0]. In other words: the new options creates a distinct hidden class compared to a plain object, which might be optimised. At the same time adding integer keys to a separate d object will not mess with this hidden class, preventing…
Klathmon · 2016-12-20
(This is my interpretation from reading around)
They went over it a bit at [0], but the "subtext" is that until recently, Node.js has been "following" what V8 does. When V8 makes a change, node needs to react and work with it. When Node needs to do something differently than chrome, they need to kind of figure it out on their own.
Now they are going to be treating node like they treat chrome. Working with them on new features, more integrations with debugging, better support for things that Node.js uses or new APIs to make the Node code simpler.
I'm hoping this also means less breakage between Node versions for native code.
There's also a (maybe new?) buildbot [1] which is continuously integrating V8 and Node's master branch so you can try out the newest at any time.
[0] https://v8project.blogspot.com/2016/12/v8-nodejs.html
[1] https://build.chromium.org/p/client.v8.fyi/builders/V8%20-%20node.js%2…
slightlyoff · 2018-09-11
WASM streaming compilation is possible today and runtimes are adding tiered compilers: https://v8project.blogspot.com/2018/08/liftoff.html
Regardless, as long as you're network-bound in the critical-path, that will only help to the extent that partial execution works well. That is baked into HTML/CSS/JS; not so much with WASM.
jashmatthews · 2018-06-10
V8 switched to an interpreter last year. It's a really interesting project: https://v8project.blogspot.com/2017/05/launching-ignition-and-turbofan…
hinkley · 2018-05-17
I'd like to see new benchmarks for that.
If you recall from the V8 6.6 release notes, they talked about performance impromevents in promise and async benchmarks.
The Notes:
(see Asynchronous performance improvements) https://v8project.blogspot.com/2018/03/v8-release-66.html
The Graph: https://2.bp.blogspot.com/-T_HWK2MlCOY/WrkGw1-ABJI/AAAAAAAAB4U/8aUwrDt…
Looks like about 20%, 30% for some benchmarks.
Note to release note authors: Please put IDs on your headers so people can cite you properly. Thank you.
tripletao · 2018-05-12
That quote describes a good mental model for someone learning JavaScript, but not necessarily the physical truth.
JavaScript's numbers can do everything doubles can; but if the compiler can prove that all values that a particular variable could possibly take on will fit in a smaller type, then it can use that. So a variable really can end up stored as an integer--or never stored anywhere for that matter, like if a loop gets unrolled and the counter is optimized out.
The bitwise operators behave as if integers are 32-bit two's complement. The typed arrays are also two's complement. A smart developer can write code that a smart compiler will compile to bitwise operations on actual physical 32-bit integers.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Oper…
https://v8project.blogspot.com/2017/09/elements-kinds-in-v8.html
bcherny · 2018-03-27
A bit buried - V8 also supports tracing DOM-related memory leaks (exposed in devtools)! https://v8project.blogspot.com/2018/03/tracing-js-dom.html?m=1
daxterspeed · 2018-03-08
It was announced in V8 6.1 that asm.js could be validated and compiled to WebAssembly. https://v8project.blogspot.se/2017/08/v8-release-61.html
To be fair I don't think this announcement ever spread that far and I don't think it was ever announced that the validation would be enabled in Chrome, nevertheless I see asm.js validation messages (or rather, invalidation messages when there's issues) in Chrome 64.
michaelmior · 2018-02-12
@dang Could this be replaced with the non-mobile link?
https://v8project.blogspot.ca/2018/02/lazy-deserialization.html
onion2k · 2018-01-30
It does do negative lookahead though -
https://regexper.com/#%2F%5Cd%2B(%3F!%5C.)%2F
Negative lookbehind only appeared in Chrome in v.62 (https://v8project.blogspot.co.uk/2017/09/v8-release-62.html) it's not too surprising that tools haven't caught up yet.
tlb · 2018-01-16
I believe so, if 'a' resolves to a getter. To optimize, it would have to prove that 'a' is a locally bound variable with no escapes or else no functions are called in the comparison.
See https://v8project.blogspot.com/2017/09/disabling-escape-analysis.html for a related bug.
fulafel · 2017-12-14
See eg https://v8project.blogspot.com/2017/11/orinoco-parallel-scavenger.html - some JS GCs are parallel and it's not the case that the "thread is locked" for the whole duration of the GC.
BlackLotus89 · 2017-11-13
These are stupid benchmarks and chrome devs stopped optimizing after them [1] because they don't matter. Michael (the phoronix guy) makes a living out of automating benchmarks and automated feed aggregation (or mailing lists) and those benchmarks especially add nothing of value to the Browser speed discussion.
https://v8project.blogspot.de/2017/04/retiring-octane.html?m=1
ballenf · 2017-10-25
https://bugs.chromium.org/p/v8/issues/detail?id=4698&q=tail%20call…
Proper tail calls is the last ES6 feature not implemented by Chrome. Can anyone shed more light on the backstory for the hold up? I've read the challenges with debugging without a stack, but Safari's implementation of tail calls seems pretty sound and was shipped about a year ago.
The last V8 blog post on the topic is almost 18 months old:
https://v8project.blogspot.com/2016/04/es6-es7-and-beyond.html
The TC39 topic they site hasn't been touched in two years:
https://github.com/tc39/proposal-ptc-syntax
mtgx · 2017-09-27
I believe they made that change in Chrome 55:
https://v8project.blogspot.ro/2016/10/fall-cleaning-optimizing-v8-memo…
hashseed · 2017-08-19
Do you have any details on what could be improved wrt V8's snapshotting? We have recently extended the feature set a lot in order to be able to snapshot full Blink contexts, and there are some efforts on-going to implement that in Node.js as well. Soon crutches like electron-link won't be necessary anymore.
Some context:
https://v8project.blogspot.com/2017/05/energizing-atom-with-v8s-custom…
https://github.com/nodejs/node/issues/13877
FabHK · 2017-08-16
In the comment section to the V8 JavaScript blog post [1], Vigna writes:
- Technically, it would be better if you used the upper
52 bits, rather than the lower 52 bits, to generate a
double. The lowest bit of a xorshift128+ generator is an
LSFR, and while people has been happy using LSFR for
decades, it is slightly inferior in quality to all other
bits. This is really OCD, as computational errors makes
the lowest bit almost irrelevant, but now you know.
I don't know whether that's been implemented, but the maintainer replied:
Thanks for the suggestions! I will definitely revisit the
current implementation with your tips in mind.
[1] https://v8project.blogspot.nl/2015/12/theres-mathrandom-and-then-there…
bricss · 2017-08-10
Yaasss! New pipeline of Ignition and Turbofan provides huge performance increases.
Read this article -> https://v8project.blogspot.com/2017/05/launching-ignition-and-turbofan…
tachyonbeam · 2017-08-02
Chrome now caches compiled code: https://v8project.blogspot.ca/2015/07/code-caching.html
In addition to this, browsers do lazy parsing. They do not fully parse the bodies of functions until the functions are executed.
clumsysmurf · 2017-06-06
Does Chrome 59 come with Ignition / Turbofan for V8 enabled ?
If i read this correctly, it does ...
https://v8project.blogspot.com/2017/05/launching-ignition-and-turbofan…
apaprocki · 2017-05-30
Basically Ignition + TurboFan:
https://v8project.blogspot.com/2017/05/launching-ignition-and-turbofan…
with a (really) brief mention of Orinoco:
https://v8project.blogspot.com/2016/04/jank-busters-part-two-orinoco.h…
and Node + Chrome DevTools:
https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome…
Octane benchmark retired because it benchmarks peak performance and doesn't account for other factors (e.g. startup time, memory usage). Speedometer2 coming to browserbench.org soon, benchmarks a much wider range of real-world frameworks.
markdog12 · 2017-04-18
I think v8 does cache machine code in some cases. There are a couple of flags in chrome://flags you'll want to look at:
V8 Caching Mode, V8 caching strategy for CacheStorage
https://v8project.blogspot.ca/2015/07/code-caching.html
Edit: Not the same as snapshots mentioned in the article
petercooper · 2017-02-23
And this is how you can try it out now in Chrome Canary: https://v8project.blogspot.com/2017/02/help-us-test-future-of-v8.html
hzoo · 2017-02-22
The purpose of Babel/transpilers is to eventually allow users to use the native versions of language features. Native support will eventually be faster (not at first), will result in less code sent to users (compiled code is larger), and easier to debug (don't need sourcemaps).
https://v8project.blogspot.com/2017/02/high-performance-es2015-and-bey…
I made https://github.com/babel/babel-preset-env to make it easier to transition. Hoping that Babel makes it easier to not have to think about whether you are using native or not, so we'll work on that workflow.
roryrjb · 2017-02-22
A short V8 5.5 feature overview: https://v8project.blogspot.nl/2016/10/v8-release-55.html