denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.22k stars 5.37k forks source link

line numbers don't match source code in chrome://inspect performance tab #25349

Open skybrian opened 2 months ago

skybrian commented 2 months ago

Version: Deno 1.46.2 Chrome 128.0.6613.114

I'm using the --inspect-wait flag to profile some Deno code. To reproduce:

git clone git@github.com:skybrian/repeat-test.git
cd repeat-test
git checkout 389357e1b3e2546dbefc6b9d9984760509b13ee2
deno --inspect-wait performance/profile_take_chars.ts

The profile runs automatically after the inspector connects and the flame graph appears after a second or two, but when I look at individual functions in the call graph, the line numbers are off. For example, there are two prune() functions that are reported to be at lines 66 and 263 of pick_tree.ts, but in the pick_tree source code, these functions are actually at 111-136 and 342-365.

Presumably the code is being transformed in some way before it's run? It would be nice if that transformation preserved newlines so that the line numbers match.

marvinhagemeister commented 2 months ago

Related https://github.com/denoland/deno/issues/4499

lucacasonato commented 2 months ago

@marvinhagemeister I'm not sure this is related - this TS code is being transpiled by Deno, not JS files coming from the user with custom source maps.