Turbocharging V8 with mutable heap numbers
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 ^ 0xc761c23c )
Continue reading on V8 Blog
Opens in a new tab

