nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
Shopify Engineering·Mar 4, 2022·12 min read52

Adding the V8 CPU Profiler to v8go - Shopify

V8 is Google’s open source high-performance JavaScript and WebAssembly engine written in C++. v8go is a library written in Go and C++ allowing users to execute JavaScript from Go using V8 isolates. Using Cgo bindings allows us to run JavaScript in Go at native performance. The v8go library, developed by Roger Chapman, aims to provide an idiomatic way for Go developers to interface with V8. As it turns out, this can be tricky. For the past few months, I’ve been contributing to v8go to expose functionality in V8. In particular, I’ve been adding support to expose the V8 CPU Profiler.  From the start, I wanted this new API to be: easy for the library's Go users to reason about easy to extend for other profiler functionality eventually aligned closely with the V8 API as performant as possible. The point about performance is especially interesting. I theorized that my first iteration of the implementation was less performant than a proposed alternative. Without benchmarking them, I proceeded to rewrite. That second implementation was merged, and I moved on with my life. So when I was like "Hey! I should write a post about the PR and benchmark the results" only to actually see the benchmarks and reconsider everything. If you’re interested in API development, Go/Cgo/C++ performance or the importance of good benchmarks, this is a story for you. Backing Up to the Starting Line: What Was My Goal? The goal of adding the V8 CPU Profiler to v8go was so users of the library could measure the performance of any JavaScript being executed in a given V8 context. Besides providing insight on the code being executed, the profiler returns information about the JavaScript engine itself including garbage collection cycles, compilation and recompilation, and code optimization. While virtual machines and the like can run web applications incredibly fast, code should still be performant, and it helps to have data to understand when it's not.  If we have access to a CPU profiler, we can

JavaScriptPerformance
Read original on shopify.engineering

Score breakdown

  • Technical depth83
  • Practical value30
  • Originality100
  • Writing quality100
  • Source reputation0
  • Recency0
  • External engagement0
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on shopify.engineering.

More like this

The Cloudflare Blog

Go, don't collect my garbage

Nov 13, 2017·14 min read
Etsy — Code as Craft

Improving performance by prefetching product pages from Etsy Search

David Weinzimmer·Oct 29, 2025·11 min read
Yelp Engineering

Optimizing Our Build Times by Migrating from Webpack to Rspack

Benson Pan +1 other·May 20, 2026·1 min read
The Cloudflare Blog

Four months of VoidZero at Cloudflare: making the open-source JavaScript toolchain faster for all humans and agents

Evan You·15 days ago·5 min read