7rulnik / source-map-js

Consume and generate source maps.
Other
95 stars 14 forks source link

Port @mraleph optimizations #2

Closed 7rulnik closed 3 years ago

7rulnik commented 3 years ago

Moved from https://github.com/benthemonkey/source-map/pull/1

I spotted the article Maybe you don't need Rust and WASM to speed up your JS written by @mraleph and decided to try to port non-hardcore optimizations.

I benchmarked it with node 14.15.4.

Before:

Parsing source map
iteration: 3.590s
iteration: 3.306s
iteration: 3.459s
iteration: 3.546s
iteration: 3.379s
iteration: 3.562s
iteration: 3.319s
[Stats samples: 7, total: 24158 ms, mean: 3451.1428571428573 ms, stddev: 128.1444497432487 ms]

After:

Parsing source map
iteration: 1.030s
iteration: 1.769s
iteration: 1.104s
iteration: 1.118s
iteration: 1.189s
iteration: 1.027s
iteration: 1.104s
iteration: 1.254s
iteration: 1.041s
iteration: 1.060s
iteration: 1.140s
iteration: 1.103s
iteration: 1.124s
iteration: 1.092s
iteration: 1.098s
iteration: 1.083s
iteration: 1.068s
iteration: 1.129s
iteration: 1.067s
iteration: 1.129s
iteration: 1.090s
iteration: 1.094s
[Stats samples: 22, total: 24913 ms, mean: 1132.409090909091 ms, stddev: 154.70478799497909 ms]
7rulnik commented 7 months ago

Applied optimizations:

TO DO: