danvk / source-map-explorer

Analyze and debug space usage through source maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Version 2.2 too slow

apocalyp0sys opened this issue · comments

Description
Report generation takes too long on windows after version 2.2.0

Steps to reproduce

> npx source-map-explorer@2.2.2 dist/*-es2015.*.js | gnomon
Total   462.7926s
>npx source-map-explorer@2.1.2 dist/*-es2015.*.js | gnomon
Total   6.6806s

Files to reproduce
Unfortnately can't share my bundle, will try to provide minimal example if this is hard to reproduce.
The bundle is an angular-cli application, a set of files ~5.2Mb total, minified js with links to .map files in the same directory.

Expected behavior
Should parse bundle and generate report fast, as in previous versions

Environment

  • OS: Windows 10 1809
  • Node 12.13.1
  • source-map-explorer 2.2.2
commented

I have similar orders-of-magnitude slowdown. Can't provide my bundles, but sizes are:

-rw-rw-r-- 1 jack jack 525K Jan 21 17:20 main.js
-rw-rw-r-- 1 jack jack 2.6M Jan 21 17:20 main.js.map

Environment

  • OS: Ubuntu 18.10
  • Node v12.14.0
  • source-map-explorer 2.2.2
commented

It is very slow on macOS either. File sizes:

-rw-r--r--  1 diniska  staff  3251044 Jan 23 22:51 2.806cfc57.chunk.js
-rw-r--r--  1 diniska  staff     1506 Jan 23 22:51 2.806cfc57.chunk.js.LICENSE
-rw-r--r--  1 diniska  staff  2997800 Jan 23 22:51 2.806cfc57.chunk.js.map
-rw-r--r--  1 diniska  staff    59610 Jan 23 22:51 main.d5e2cfc4.chunk.js
-rw-r--r--  1 diniska  staff   125445 Jan 23 22:51 main.d5e2cfc4.chunk.js.map
-rw-r--r--  1 diniska  staff     1549 Jan 23 22:51 runtime-main.213bd834.js
-rw-r--r--  1 diniska  staff     8268 Jan 23 22:51 runtime-main.213bd834.js.map

It is fast enough for all the files from the list except 2.806cfc57.chunk.js.
Also, I use typescript, and the old version of the source-map-explorer (2.1.2) shows half of this file as [no source]. I'd be fine with the older version, but completely not sure what this [no source] means.

Also having the same problem on Mac with 2.2.2. Took 5 minutes. With 2.1.2 basically was instant. I can provide an example files if needed.

I'm having the same problem on Linux.

Linux: 5.4.15-arch1-1
Node: 13.7.0
Create-React-App with TypeScript 3.7.5

Link to repo

I tested different versions of source-map-explorer and as we can see, 2.2.0 introduced the problems for me. From 5s to 10min.

npx source-map-explorer@2.1.2 build/static/js/*.js | gnomon
Unable to map 207/3280888 bytes (0.01%)
Unable to map 149/48429 bytes (0.31%)
Unable to map 13/1597 bytes (0.81%)
  4.6544s   build/static/js/2.d7aa2ef4.chunk.js
  0.0007s   build/static/js/main.9111df4f.chunk.js
  0.2300s   build/static/js/runtime-main.ddde9e8a.js
  0.0004s   
Total   4.8865s
npx source-map-explorer@2.2.0 build/static/js/*.js | gnomon
Unable to map 207/3280888 bytes (0.01%)
Unable to map 149/48429 bytes (0.31%)
Unable to map 13/1597 bytes (0.81%)
594.2438s   build/static/js/2.d7aa2ef4.chunk.js
  0.0007s   build/static/js/main.9111df4f.chunk.js
  0.6000s   build/static/js/runtime-main.ddde9e8a.js
  0.0004s   
Total   594.8463s
npx source-map-explorer@2.2.2 build/static/js/*.js | gnomon
Unable to map 207/3280888 bytes (0.01%)
Unable to map 149/48429 bytes (0.31%)
Unable to map 13/1597 bytes (0.81%)
554.1818s   build/static/js/2.d7aa2ef4.chunk.js
  0.0007s   build/static/js/main.9111df4f.chunk.js
  0.2438s   build/static/js/runtime-main.ddde9e8a.js
  0.0004s   
Total   554.4285s

@nikolay-borzov Should we revert? I wonder if there's some kind of N^2 behavior going on with this change:
9c3195d#diff-217996167f456ef6ed8c3fd188b5c188R8

Please use version 2.1.2.
I suppose slowness is caused by size calculation logic changes. Instead of counting columns count SME calculates text string bytes size.
We need to find the place in code with biggest impact.

All right, thanks!
I created a branch, so that you have a snapshot, perhaps this can help you to find the problem.
Branch

I was convinced something was wrong with out code or bundles but I ended up downgrading to 2.1.2 and everything just worked fine again...

Yup, can confirm, still too slow to even wait for the end. 2.1.2 is instant. macOs 10.15.2