-
Notifications
You must be signed in to change notification settings - Fork 461
Description
This line will always execute in workerd (because errorReporter != kj::none)
workerd/src/workerd/io/worker.c++
Lines 1309 to 1311 in 65feef1
| if (isolate->impl->inspector != kj::none || errorReporter != kj::none) { | |
| lock.v8Isolate->SetCaptureStackTraceForUncaughtExceptions(true); | |
| } |
This has an effect even when running normally without an inspector attached, and even when the thrown objects are caught (So the "ForUncaughtExceptions" bit is apparently not true – will investigate this in the v8 codebase)
For certain Next.js streaming rendering workloads this can have quite an impact because React uses throw for flow control (I know, let's not go there).
By removing this line I see a 26% improvement in performance – again, just when running normally, no inspector attached.
If we want to keep the logic as is (Do we? Or should we drop the errorReporter != kj::none bit and only have this execute when we're attached to an inspector?) – then I propose that we make it configurable, so that people running workerd in production, or when benchmarking, are not hindered by this behaviour. Basically I just want an option to not execute this line.