feat: add MacOS support#81
Conversation
Merging this PR will degrade performance by 16.23%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | iterative fibo 15 |
312 ns | 900 ns | -65.33% |
| ❌ | WallTime | iterative fibo 20 |
360 ns | 900 ns | -60% |
| ❌ | WallTime | short body |
1.7 µs | 2.8 µs | -37.66% |
| ❌ | WallTime | short body |
1.7 µs | 2.6 µs | -33.64% |
| ❌ | WallTime | short body |
1.8 µs | 2.5 µs | -31.13% |
| ❌ | WallTime | short body |
1.8 µs | 2.5 µs | -30% |
| ❌ | WallTime | short body |
1.7 µs | 2.4 µs | -28.86% |
| ❌ | WallTime | short body |
1.8 µs | 2.5 µs | -27.96% |
| ❌ | Simulation | switch 2 |
8.3 µs | 11.2 µs | -25.47% |
| ❌ | Memory | short body |
408 B | 536 B | -23.88% |
| ❌ | WallTime | fibo 10 |
2.1 µs | 2.8 µs | -23.04% |
| ❌ | Simulation | wait 1ms |
20 µs | 22.8 µs | -11.95% |
| ⚡ | Memory | wait 1ms |
16 B | 7 B | ×2.3 |
| ⚡ | Simulation | short body |
121.2 µs | 76.1 µs | +59.37% |
| ⚡ | Simulation | long body |
382.1 µs | 336.1 µs | +13.69% |
| ⚡ | WallTime | switch 1 |
324 ns | 288 ns | +12.5% |
| ⚡ | WallTime | test sync baz 10 |
360 ns | 324 ns | +11.11% |
| ⚡ | WallTime | test sync baz 100 |
480 ns | 432 ns | +11.11% |
| ⚡ | WallTime | test sync baz 10 |
384 ns | 348 ns | +10.34% |
| 🆕 | WallTime | fibo darwin |
N/A | 7.9 ms | N/A |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing cod-2720-bump-instrument-hooks-in-codspeed-node-to-support-macos (c184ad6) with main (4dae798)
f0b1349 to
3982c34
Compare
32c3b31 to
1d75a61
Compare
Greptile SummaryThis PR adds macOS support to the CodSpeed Node.js benchmarking plugins by centralizing the
Confidence Score: 4/5The macOS walltime support is functionally sound in the vitest plugin path, but the tinybench plugin emits benchmark markers after closing the sample window, which both breaks the new integration test and produces incorrect profiling data on the tinybench walltime path. In packages/tinybench-plugin/src/shared.ts, sendBenchmarkMarkers() is called after stopBenchmark() and setExecutedBenchmark(). The code's own comment, the vitest-plugin reference implementation, and the newly added integration test all require the markers to be emitted before stopBenchmark(). The test will fail as written, and any tinybench walltime benchmark run on macOS will have misattributed or missing flame graph data. packages/tinybench-plugin/src/shared.ts — both wrapWithInstrumentHooks and wrapWithInstrumentHooksAsync call sendBenchmarkMarkers after stopBenchmark(), inverting the required ordering. Important Files Changed
|
762c0d8 to
93cf800
Compare
93cf800 to
e08c11f
Compare
Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch.
|
792ee5f to
fea06fe
Compare
fea06fe to
48a2b46
Compare
|
Although CI is failing. |
79e8686 to
39e7a35
Compare
Emit benchmark start/end markers for the tinybench plugin and the vitest walltime runner, wrapping the measured function in a root frame. The runner consumes the instrument-hooks FIFO stream in order and expects SampleStart > BenchmarkStart > BenchmarkEnd > SampleEnd nesting per benchmark, so the markers must land inside the sample window: - vitest: emit the marker pair before stopBenchmark(), and move stopBenchmark() plus the markers into a finally block so a throwing benchmark cannot leave the profiler started-but-never-stopped - tinybench: emit markers per task between start/stop instead of a single run-level pair; wrap the body in try/finally to keep start/stop balanced when a benchmark throws - benchmark.js: bind wrapWithRootFrame/wrapWithRootFrameSync to the real implementations in the integ test's core mock Add a regression test asserting both markers land between startBenchmark and stopBenchmark in walltime mode.
Add benches/macos.bench.ts guarded with describe.skipIf(!darwin) so it only runs on macOS, and wire the walltime-macos-test CI job to execute it via a direct `node vitest.mjs bench --run macos` invocation.
7a06ec3 to
c184ad6
Compare
No description provided.