Find Related products on Amazon

Shop on Amazon

Turbocharging V8 with mutable heap numbers · V8

Published on: 2025-07-15 21:18:57

At V8, we're constantly striving to improve JavaScript performance. As part of this effort, we recently revisited the JetStream2 benchmark suite to eliminate performance cliffs. This post details a specific optimization we made that yielded a significant 2.5x improvement in the async-fs benchmark, contributing to a noticeable boost in the overall score. The optimization was inspired by the benchmark, but such patterns do appear in real-world code. The target async-fs and a peculiar Math.random # The async-fs benchmark, as its name suggests, is a JavaScript file system implementation, focusing on asynchronous operations. However, a surprising performance bottleneck exists: the implementation of Math.random . It uses a custom, deterministic implementation of Math.random for consistent results across runs. The implementation is: let seed ; Math . random = ( function ( ) { return function ( ) { seed = ( ( seed + 0x7ed55d16 ) + ( seed << 12 ) ) & 0xffffffff ; seed = ( ( seed ^ 0xc761 ... Read full article.