cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

"are source maps just… really really really slow?"

Open armanbilge opened this issue 3 years ago • 3 comments

Running the tracing example from the docs on Node.js with the exact same tracing parameters. https://typelevel.org/cats-effect/docs/tracing#complete-code

CATS_EFFECT_TRACING_BUFFER_SIZE=64 CATS_EFFECT_TRACING_MODE=FULL node --enable-source-maps example/js/target/scala-2.13/cats-effect-example-fastopt/main.js

With sourcemaps:

real    0m4.981s
user    0m4.218s
sys     0m1.119s

Without:

real    0m0.169s
user    0m0.152s
sys     0m0.025s

One idea is to provide tooling/utility that takes unsourcemapped exceptions + a sourcemap and provides sourcemapped exceptions.

armanbilge avatar Nov 17 '21 17:11 armanbilge

Relevant to https://github.com/typelevel/cats-effect/issues/2284.

armanbilge avatar Nov 17 '21 17:11 armanbilge

Another idea to try is loading source-maps into memory (instead of file access) as demonstrated here: https://www.npmjs.com/package/source-map-support#options

H/t @ChristopherDavenport

armanbilge avatar Nov 17 '21 18:11 armanbilge

A follow up on this: my measurements used node --enable-source-maps which actually doesn't use source-map-support (see https://github.com/scala-js/scala-js-js-envs/issues/20, https://github.com/typelevel/cats-effect/pull/2582) so the comment above might not be relevant actually.

Also, I'm not sure if using the default source map functionality in Scala.js (which uses source-map-support) has the same performance problem. I don't think so, but should check again.

armanbilge avatar Nov 24 '21 21:11 armanbilge