wavesoft / dot-dom

.dom is a tiny (512 byte) template engine that uses virtual DOM and some of react principles
Apache License 2.0
809 stars 53 forks source link

Uglify#harmony as alternative minifier #21

Closed PascalPflaum closed 7 years ago

PascalPflaum commented 7 years ago

17

I some research about ES6+ minifier. It looks like uglifyjs2 is the only one able to do the task right now beside babili of course. The ES6+ isn't in master yet, but there is a harmony branch, which is working fine.

I was suprised to see that the .gz build with uglify2js was 9byte smaller when I run the first test.

However after merging your latest changes uglify produces a bigger file.

I setup an alternative build target, that can be executed with "npm run build:uglify"

wavesoft commented 7 years ago

That's interesting findings @PascalPflaum ! ✨ 💯
I am curious to see what optimisations does uglifyjs2 in comparision to babili. The key to the gzipped result is to try and create repeating patterns. I am guessing that the latest changes broke some of these patterns for uglifyjs2.

But that will definitely come in handy on micro optimising new features! Thanks for the effort 👍

PascalPflaum commented 7 years ago

Hi.

I figured out why UglifyJS2 was not performing as well after I merged your changes. I didn't executed the perl string stripping.

The build with UglifyJS2 is no 11 Byte smaller than using babili.

PascalPflaum commented 7 years ago

if you are interested I would add a bigger script / task runner target that would build a .gz with "n" tool chains and then picks the smallest .gz + some verbose output.

My preferred toolchain for this would be grunt + watch-plugin + a custom grunt plugin I would write for this scenario, but I'm open minded If you prefer other tools.

wavesoft commented 7 years ago

That sounds like an interesting idea @PascalPflaum . Can you also create an issue where we keep track of this until we have a PR?

wavesoft commented 7 years ago

Gulp is OK with me btw.

wavesoft commented 7 years ago

Ps. That's great news! This might actually help solve some problems in lifecycle branch!