Named imports fix V8 inlining: OTel JS Tracer gets ~2x throughput
DanielLockyer · x · 2026-11-18
Daniel Lockyer's merged PR #7355 in open-telemetry-js: Tracer.ts used import as api, which in the CommonJS build compiles to a toESM helper wrapping every export in a getter backed by a bound function — V8 can't inline it, so every api.context.active() / api.trace.getSpan() call in startSpan was a real function call.
CPU profiling showed the toESM getter alone took 9.4% of samples in a bare tracer.startSpan('op').end() (require-loaded), with startSpan self time at 39.7%; loading the same build with import cut self time to 11.4% and roughly doubled throughput. Switching to named imports removes the overhead.
More from Infra
- Wall Street Execs and NSA Tell Congress: AI-Discovered Vulnerabilities Triggered Outage-Causing Patching Rush — Jsevillamol · 2026-11-18
- 0.5B Rumble-2-Flash ASR beats Whisper large-v3 with 30% fewer errors at a third the size — ricklamers · 2026-11-18
- Nvidia halts shipments of US-approved AI chips to China, Reuters reports — minchoi · 2026-11-18
- Analyst stands by $20 trillion Nvidia market cap thesis by 2030 — Beth_Kindig · 2026-11-18
- armless: A Rust-Written AArch64 Emulator Boots Linux 6.8 in a Browser Tab — sull · 2026-11-18
- Fast path for primitive attributes boosts OTel span creation up to 24% — DanielLockyer · 2026-11-18