Swap Object.entries for Object.keys to cut allocations in OTel cleanAttributes
DanielLockyer · x · 2026-11-18
Daniel Lockyer's third OTel JS perf PR (#7353): cleanAttributes runs on span start attributes, every addEvent, addLink, and log record. It used to iterate with Object.entries(), which allocates an array of [key, value] pair arrays on every call, with cost scaling by attribute count.
Switching to Object.keys() plus key lookups visits exactly the same keys in the same order (behavior unchanged) while eliminating the intermediate array allocations. Benchmarked on Node.js v26.13.1. Together the three PRs meaningfully cut OTel JS SDK observability overhead.
Related event: OpenTelemetry Node.js SDK Gets 2.4x Speedup from Loop Optimization(2 posts)→
More from Infra
- 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
- Named imports fix V8 inlining: OTel JS Tracer gets ~2x throughput — DanielLockyer · 2026-11-18
- Fast path for primitive attributes boosts OTel span creation up to 24% — DanielLockyer · 2026-11-18