perf_hooks: only enable GC tracking when it's requested
Previously a GC prologue callback and a GC epilogue callback
are always unconditionally enabled during bootstrap when
the performance
binding is loaded, even when the user does
not use the performance timeline API to enable GC tracking.
This patch makes the callback addition conditional and only
enables them when the user explicitly requests
observer.observe(['gc'])
to avoid the overhead.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines