V8 Now Supports JIT-less JavaScript Execution

March 14, 2019 Posted by Programming 0 thoughts on “V8 Now Supports JIT-less JavaScript Execution”

The V8 team announced yesterday that JavaScript developers now have the ability to go JIT-less when developing apps. In an article we published, we detailed exactly what JIT is in the context of JavaScript’s engine:

” JavaScript’s compilers are forced to compile the code at the last second — literallyThe technology used to compile JavaScript is aptly named Just-In-Time(JIT). This “compilation on the fly” has appeared in modern JavaScript engines to speed up the browsers that implement them.”

In the words of the engineers who built the TurboFan optimizing compiler,

“the TurboFan optimizing compiler creates native code for hot JavaScript (JS) functions just-in-time, and most JS regular expressions are compiled down to native code by the irregexp engine. Creating executable memory at runtime is part of what makes V8 fast.”

The problem that the engineers and developers are aware of is the fact that some platforms like the iOS, smart TVs, and game consoles don’t allow write access to memory for third party developers, so JIT becomes a moot feature.  In that case, having an option to switch JIT off can allow for better accessibility when developing for platforms that don’t support JIT.

This prompted V8’s engineers to finally develop a –jitless flag which essentially turns JavaScript into what it’s usually advertised as being: an interpreted language. All of the code is funneled into V8’s Ignition interpreter. Unfortunately, V8 doesn’t support Web Assembly, which might have been able to counteract the inevitable penalty for removing JIT.

“WebAssembly is currently unsupported, but interpretation is also in the realm of possibility. V8’s builtins are still compiled to native code, but are no longer part of the managed JS heap, thanks to our recent efforts to embed them into the V8 binary.”

 

After testing JIT-less mode versus JIT mode on  Youtube TV, the engineers found that JIT-less mode showed a 6% performance hit as compared to the standard configuration.  The V8 team acknowledged that the performance regression was small relative to the  40% performance hit on Speedometer 2.0, leading them to conclude that testing environments don’t always translate to real world results.

image source: V8

 

Though one can also argue that Youtube TV is just one example and that further testing may reveal larger performance hits depending on the structure of the app. In any case, V8 has provided an alternative for those willing to work on restricted platforms. The performance hit might be negligible enough to try out JIT-less V8.

 

 

Please follow and like us:
0
Tags: , , ,