Skip to content

perf: LatencyHistogram → @stackbilt/wasm-core adapter (closes #96)#101

Merged
stackbilt-admin merged 1 commit into
mainfrom
auto/refactor/issue-96
Jun 23, 2026
Merged

perf: LatencyHistogram → @stackbilt/wasm-core adapter (closes #96)#101
stackbilt-admin merged 1 commit into
mainfrom
auto/refactor/issue-96

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Summary

  • Replaces the pure-JS LatencyHistogram with a thin adapter over @stackbilt/wasm-core@0.1.0 (Phase 0 of the wasm-core roadmap)
  • Rust implementation: sorted Vec with binary search insertion — O(log N) insert, O(1) percentile read; O(1) circular eviction replacing Array.shift()
  • No public API change — same constructor, method signatures, and exact nearest-rank percentile semantics preserved
  • allSummaries() uses a tracked provider Set on the adapter side (works around a all_summaries() gap in the WASM binding where the map returns {})

Test plan

  • All 487 existing tests pass (npm test) — observability.test.ts LatencyHistogram suite covers all semantics including eviction, allSummaries, reset (specific + all), and percentile math
  • TypeScript typecheck clean (npm run typecheck)
  • Vitest config updated with pool: 'forks' + execArgv: ['--experimental-wasm-modules'] to load WASM in the Node.js test environment

Closes #96

🤖 Generated with Claude Code

…loses #96)

Thin adapter over @stackbilt/wasm-core@0.1.0. Rust impl uses sorted Vec
with binary search (O(log N) insert, O(1) percentile) and circular eviction
(O(1)) instead of Array.shift + sort-on-read. Exact nearest-rank semantics
preserved; all 487 tests pass. Vitest config updated to enable
--experimental-wasm-modules in the fork pool so WASM loads in Node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit 0aff4c2 into main Jun 23, 2026
0 of 2 checks passed
@stackbilt-admin stackbilt-admin deleted the auto/refactor/issue-96 branch June 23, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: replace LatencyHistogram sort-on-read with Rust→WASM t-digest (@stackbilt/wasm-core)

1 participant