Skip to content

Commit 329b067

Browse files
committed
fix(core): bind the native addon's symbols at load
With lazy binding, the first `stopBenchmark()` of a process resolved `instrument_hooks_stop_benchmark` through the dynamic linker while the benchmark was still measured. Link the addon with `-z now` so symbols resolve when it loads. Under callgrind this removes 2,339 Ir from the first benchmark of examples/with-vitest-v5, and brings `switch 1` of examples/with-typescript-simple-esm to 4,625 Ir.
1 parent e962378 commit 329b067

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎packages/core/binding.gyp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
"-Wno-unused-but-set-variable",
3737
"-Wno-type-limits"
3838
],
39+
# Resolve symbols at load: lazy binding would resolve
40+
# instrument_hooks_stop_benchmark on its first call, inside the
41+
# first measured benchmark.
42+
"ldflags": [
43+
"-Wl,-z,now"
44+
],
3945
"sources": [
4046
"src/native_core/linux_perf/linux_perf.cc",
4147
"src/native_core/linux_perf/linux_perf_listener.cc",

0 commit comments

Comments
 (0)