Comments (4)
17f97c5 has been pushed with 10% speed improvement.
These changes need to occur to make it faster, and I'm not sure if it's worth it:
- the HTML tokenizer returns strings, would save a realloc to return []byte
- the CSS parser builds a node tree which is heavy on allocs and the GC
- ignore io.Writer errors from Write (not sure if this is safe)
- the HTML minifier functions takes most time, but there isn't a way to improve it much...
from minify.
e346a3c pushed with another 10% speed improvement.
It now takes []byte instead of string from the HTML tokenizer and uses atom.Atom enum for tags and attributes for fast comparison (instead of []byte equality tests).
Ignoring io.Writer errors will not increase performance significantly.
The only way to speed up is to reduce memory usage, but that is hardly possible!
from minify.
Great improvement of 30% with e219023 and somewhat with 31ef4d6 by refactoring the code.
Speed could be improved if HTML tokenizer didn't unescape text tokens and attribute values, so the minifier wouldn't have to re-escape them.
from minify.
HTML minification speed significantly increased by writing a new tokenizer 3b90fc7. The tokenizer is equal in speed, but more assumptions can be made to avoid memory copying and HTML entities re-escaping. Most of the speed improvement is actually from re-using the token buffer better and other things.
Avoiding allocations in 9831f46 also helped.
Additonally, the bytes.Equal
is slightly slower for some reason than self-implementing it. And by using literal byte slices instead of literal strings to byte slice casts improved speed too: b36014e.
Furthermore, attribute escaping was a bottleneck: df03a65
Total speed increased by almost 50%!
from minify.
Related Issues (20)
- Bug: return statement causes error HOT 2
- Max amount of exclude statements HOT 1
- Docker hub tags HOT 3
- return statement causes error in onclick HOT 2
- Minify v2.20.5 removes essential part of JS functions HOT 2
- Regression with 2.20.5 (from 2.20.1) HOT 2
- Tests broken on v2.80.2 HOT 1
- Compile error in v2.20.8? HOT 2
- WARNING: preserve ownership not supported on platform HOT 11
- High CPU Usage After Minification HOT 3
- Since version 2.20.8 I got error "panic: runtime error: index out of range [nnn] with length nnn" HOT 3
- CSS with @layer is not well compressed HOT 1
- Minify private methods and private properties of JS classes HOT 3
- JS: "SyntaxError: Invalid or unexpected token" after minifying pdfmake.js HOT 1
- JS: '\u0022' minified to """ HOT 1
- Breaks on current jQuery versions HOT 2
- Comments beginning with # are not removed HOT 1
- Middleware skips some mimetype HOT 3
- Issues with deprecation of KeepConditionalComments HOT 1
- `minify` package for Alpine Linux doesn't show version. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minify.