Results 616 comments of Joyee Cheung

Not sure what's the way to make progress here...the CI failures are unrelated AFAICT, but the test won't be passing since canary-base isn't working yet. What's the policy for landing...

Backport in https://github.com/nodejs/node/pull/56927

`createTracing()` is for user-land tracing to get hooked into our tracing infra. Pretty sure internally we can just use `internalBinding('trace_events').trace`, which is already what we load during startup.

Actually `console.time()` and `console.timeEnd()` is hooked into the tracing infra via `internalBinding('trace_events').trace` too. So for timing-related traces, adding some sort of support in debuglog to also emit traces via `internalBinding('trace_events').trace`...

> even if the _load throws an unexpected error? Where is that error coming from? I think most error paths are ending the timers here already? (especially the try-catch around...

Hmm I see, the inner functions can throw too. Can we minimize the changes by adding an internal helper in cjs/loader.js that wraps Module._load with a try-finally block that also...

Actually putting try-catch around `Module._load` might have the additional benefit that...if users monkey-patch it (😅) we can also measure the time took in the monkey-patched `Module._load` (e.g. with [Yarn pnp](https://github.com/yarnpkg/berry/blob/c64644ae88ba42090ab9b87da0b09601d4218b0c/packages/yarnpkg-pnp/sources/loader/applyPatch.ts#L61)),...

> But I also noticed a lot of places where _load is called directly, should we rewrite those places to call wrapModuleLoad? Yes. > Those places don't call requireDepth, so...

> If there are no reasons not to, switch to using ClangCL as a default compiler for future releases - Potentially Node.js v23 would be a nice time to do...

Without a repro it's hard to tell what's going on here. From the stack trace it could be a V8 bug.