node-source-map-support icon indicating copy to clipboard operation
node-source-map-support copied to clipboard

Please upgrade source-map to 0.7.2 to get speed improvements

Open andreicristianpetcu opened this issue 7 years ago • 13 comments

The latest source-map which is v0.7.2 got support for WebAssembly and it is 10 times faster than the old one. More info here:

https://github.com/mozilla/source-map/blob/master/CHANGELOG.md#072 http://fitzgeraldnick.com/2018/02/26/speed-without-wizardry.html https://hacks.mozilla.org/2018/01/oxidizing-source-maps-with-rust-and-webassembly/ https://github.com/devtools-html/debugger.html/issues/5598

Please update so you would get 10 times speed improvements for your library in Firefox, 9 times in Safari and 5 times in Chrome.

andreicristianpetcu avatar Mar 04 '18 15:03 andreicristianpetcu

This is awesome, we need to figure out what breaking changes (if any) occurred in 0.7.0, then we are good to go!

PRs welcome!

LinusU avatar Mar 04 '18 17:03 LinusU

Breaking change: Drop support for Node < 8. If you want to support older versions of node, please use v0.6 or below.

Hmmmm, this might be a big problem for us... 🤔

LinusU avatar Mar 04 '18 17:03 LinusU

Is this possible? SourceMapConsumer now returns a Promise, but catching and mapping thrown exceptions needs to be synchronous.

loganfsmyth avatar Mar 04 '18 19:03 loganfsmyth

Jest is also unable to upgrade due to the lack of a sync API, FWIW

SimenB avatar Mar 18 '18 09:03 SimenB

@SimenB Could deasync help here? It hooks into Node's event loop and essentially makes any async operation a sync one.

niieani avatar Apr 28 '18 13:04 niieani

I published https://www.npmjs.com/package/@snek/source-map-support which works nicely in node and may work in browsers that allow you to load reasonable sized wasms synchronously. It wraps the 0.8.0-beta.0 release of source-map.

devsnek avatar Jun 20 '19 16:06 devsnek

@andreicristianpetcu @devsnek there is no case for async source map consumer other than problems of specific ill-thought implementation by Mozilla. Like: await in stack trace handler? Are they nuts?

pkit avatar May 06 '21 09:05 pkit

@cspotcode/source-map-support uses @cspotcode/source-map-consumer which is a fork of source-map that only has the consumer. @cspotcode/source-map includes the generator, too.

These are based on the latest source-map version. They use WASM and have a sync API.

You might have luck giving them a try. It's all open-source, so of course the changes can be ported over.

cspotcode avatar Aug 30 '21 17:08 cspotcode

This will also fix an annoying issue in VS Code.

source-map@<0.7.1 has an invalid typings field in its package.json which is causing VS Code to report an error that it can't find the type declarations. This is fixed in source-map@>=0.7.1.

jordanbtucker avatar Feb 24 '22 02:02 jordanbtucker

Babel has migrated to https://npmjs.com/package/@jridgewell/trace-mapping, should this module as well? Code change seems fairly trivial (no idea about browser support, but probably?)

SimenB avatar Apr 20 '22 12:04 SimenB

Has anyone done benchmarks of the various options? I haven't, so I really don't know if they're different: if wasm is faster/slower/whatever.

EDIT: I see them in the README now. Will check them out.

cspotcode avatar Apr 20 '22 13:04 cspotcode

Jest and C8 (via v8-to-istanbul) has also migrated, fwiw

SimenB avatar Apr 20 '22 13:04 SimenB

I can migrate @cspotcode/source-map-support as well.

Would be nice to consolidate the ecosystem a bit more.

cspotcode avatar Apr 20 '22 20:04 cspotcode