Open avesus opened 8 years ago
The main issue is we are mapping characters 1 by 1 when really we should be mapping ranges (e.g. 1-20 -> 3-15). If you are interested in improving that, then please look at source-map-index-generator
.
https://github.com/twolfson/node-jsmin-sourcemap/blob/0.16.0/package.json#L36
Thank you for the reference!
On Tuesday, July 5, 2016, Todd Wolfson notifications@github.com wrote:
The main issue is we are mapping characters 1 by 1 when really we should be mapping ranges (e.g. 1-20 -> 3-15). If you are interested in improving that, then please look at source-map-index-generator.
https://github.com/twolfson/node-jsmin-sourcemap/blob/0.16.0/package.json#L36
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/twolfson/node-jsmin-sourcemap/issues/2#issuecomment-230623569, or mute the thread https://github.com/notifications/unsubscribe/AD9MI65fi4GmFX-RN-M26AtMYT2K13xnks5qSt1fgaJpZM4JFdlp .
Best Regards, Ivan Borisenko
I think it is necessary to refactor Douglas' code to make it extendable because most of words detecting logic lies there.
Source mapper code: https://github.com/twolfson/source-map-index-generator/blob/master/lib/source-map-index-generator.js
Douglas' code converted into JavaScript which needs refactoring and extending: https://github.com/twolfson/node-jsmin2/blob/master/lib/jsmin.c.index.js
jsmin2
is intentionally a more/less direct port of the C library. If you want to refactor it, then it's no longer JSMin but another minification library.
For reference, nothing in the JSMin code detects words per-se; it strips out whitespace and comments when it's possible. This is done by walking on every single character which is the same as removing characters by index.
The main change that needs to occur in source-map-index-generator
is that we should group rows/columns which are next to each other so it can be a much shorter final piece of data which will improve performance when read by browsers.
About slow performance I mean time of building comparing with node.js version of jsmin without source maps support. Not even browser debugging performance.
It is possible to made superfast partner for UglifyJS2 based on this.
On Thursday, July 7, 2016, Todd Wolfson notifications@github.com wrote:
jsmin2 is intentionally a more/less direct port of the C library. If you want to refactor it, then it's no longer JSMin but another minification library.
For reference, nothing in the JSMin code detects words per-se; it strips out whitespace and comments when it's possible. This is done by walking on every single character which is the same as removing characters by index.
The main change that needs to occur in source-map-index-generator is that we should group rows/columns which are next to each other so it can be a much shorter final piece of data which will improve performance when read by browsers.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/twolfson/node-jsmin-sourcemap/issues/2#issuecomment-231030840, or mute the thread https://github.com/notifications/unsubscribe/AD9MI232Rgd1f1Z6JtP8oG83kVPet0p_ks5qTMjBgaJpZM4JFdlp .
Best Regards, Ivan Borisenko
Ah, I see. For a performance issue like that, it's best to triage it by binary searching the code; start by removing all new code and verifying performance matches what we expect, then slowly restore pieces until it falls apart, then you have your bottleneck and can contemplate what to do.
Probably it is better to modify Douglas' code to emit source mapping?