-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception throw is VERY slow in Deno #1087
Comments
Yes I’ve noticed it too - I think there must be a timeout somewhere (tokio?) |
or is the |
I did a bit of investigation:
I traced the slowness to a specific call Lines 245 to 251 in 2cfa608
It does not hang on the first call to For
So it appears that it's the first position decoding inside of Ideally we would be able to decode |
So, the above commit solves the problem but makes incremental builds 3m instead of 30s due to longer decoding the source map during the snapshot process. Additionally it more than doubles binary size... |
@ry the source maps include the sources at the moment, part of why it is so large. I suspect they aren't needed for just unwrapping stacks, so I suspect we can eliminate them. If you don't get the chance, I will try today and raise a PR if it works. |
@ry taking a look at it, rollup is adding |
At minimum we need to be tracking this slowness. I add error_001.ts to the benchmark page in the above commit. @kitsonk Cool thanks for looking into it! Maybe to just evaluate if that will work, manually hack rollup in third_party/node_modules |
@ry further investigation shows that it is rollup that is specifically inlining the sources, that it isn't optional, but it feels like a fairly clean process to make it optional. I am going to raise an issue and a PR for rollup, but once I have it working I can take our custom build into |
I have raised a PR at rollup/rollup#2531 which fixes this and will attempt to integrate the custom build into |
FWIW we had that problem on fly.rs and we decided to do sourcemaps in Rust instead of inside V8. The first error that needed to print original lines from the source map would take a long long time. The https://github.com/superfly/fly.rs/blob/master/src/runtime.rs#L261-L302 It's not ideal, but it's implemented using a "source map thread" + channel, since the sourcemap crate is not thread-safe. It's a channel accepting a Vec of tuples (line, column, function name, filename) and a oneshot for the "response". I'm sure there are better ways haha. It could at least be rewritten with a nicer API. It also had the side-effect of freeing a good chunk of memory inside V8 (from 6-7MB down to 3MB.) I assume that memory was "transferred" to Rust though. (edit: maybe not, looks like that crate is pretty efficient at parsing a source map and doesn't need to load it all in memory) |
When running a script that throws an uncaught exception, it takes a few seconds to actually print out the error message and exit.
From @kitsonk
The text was updated successfully, but these errors were encountered: