Javascript minifiers
-
Having never heard of a 'minifer', I followed the link that you said worked; OK, I understand what they are now. The next question is: does the page/site load noticeably faster when using the 'minifer'ed version? If so, what percent increase was seen?
Tim Carmichael wrote:
The next question is: does the page/site load noticeably faster when using the 'minifer'ed version?
Yes -- keep in mind not everyone is on highspeed internet, so minifying the javascript your website references can result in a 50% speed improvement on loading. Potentially more if you're on a satellite connection where the round trip ACK for each TCP/IP packet (typical [MTU](https://stackoverflow.com/questions/2613734/maximum-packet-size-for-a-tcp-connection) of 1500 bytes) can be time consuming, though having simulated such stuff, I would imagine that a satellite "router" attempts to deal with this by not using TCP/IP directly over the satellite, where every 1500 byte packet requires an ACK. Basically, minifying Javascript is a quite simple method of improving website performance regardless of the connection quality. It also makes the javascript harder to read by would-be hackers or the just plain curious. Obviously one wouldn't do this during development!
Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
So you have about (46K-37K)/2 times something like ...map(([n,t])=>.... ? :)
It does not solve my Problem, but it answers my question
0x01AA wrote:
So you have about (46K-37K)/2 times something like
It did make me wonder, but no, I don't. :laugh:
Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on
class Helpers {
[https://jscompress.com/\](https://jscompress.com/) Fails onclass Helpers {
[https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced:Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t))
Note[n,t]
needs to be([n,t])
Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
Tim Carmichael wrote:
The next question is: does the page/site load noticeably faster when using the 'minifer'ed version?
Yes -- keep in mind not everyone is on highspeed internet, so minifying the javascript your website references can result in a 50% speed improvement on loading. Potentially more if you're on a satellite connection where the round trip ACK for each TCP/IP packet (typical [MTU](https://stackoverflow.com/questions/2613734/maximum-packet-size-for-a-tcp-connection) of 1500 bytes) can be time consuming, though having simulated such stuff, I would imagine that a satellite "router" attempts to deal with this by not using TCP/IP directly over the satellite, where every 1500 byte packet requires an ACK. Basically, minifying Javascript is a quite simple method of improving website performance regardless of the connection quality. It also makes the javascript harder to read by would-be hackers or the just plain curious. Obviously one wouldn't do this during development!
Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Thank you; I can see where it would be beneficial. I've largely spent my career in the local world and largely avoiding web development. Now, if there was some way to compile it... but that is a whole other barrel of fish.
-
Tim Carmichael wrote:
The next question is: does the page/site load noticeably faster when using the 'minifer'ed version?
Yes -- keep in mind not everyone is on highspeed internet, so minifying the javascript your website references can result in a 50% speed improvement on loading. Potentially more if you're on a satellite connection where the round trip ACK for each TCP/IP packet (typical [MTU](https://stackoverflow.com/questions/2613734/maximum-packet-size-for-a-tcp-connection) of 1500 bytes) can be time consuming, though having simulated such stuff, I would imagine that a satellite "router" attempts to deal with this by not using TCP/IP directly over the satellite, where every 1500 byte packet requires an ACK. Basically, minifying Javascript is a quite simple method of improving website performance regardless of the connection quality. It also makes the javascript harder to read by would-be hackers or the just plain curious. Obviously one wouldn't do this during development!
Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
Marc Clifton wrote:
It also makes the javascript harder to read by would-be hackers or the just plain curious.
Not so much anymore, Chrome has the ability to pretty print JavaScript and CSS now. Plus unminifier tools are freely available out there too. Accidentally minified my source JS file once... yay for unminifiers.
-
Thank you; I can see where it would be beneficial. I've largely spent my career in the local world and largely avoiding web development. Now, if there was some way to compile it... but that is a whole other barrel of fish.
-
So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on
class Helpers {
[https://jscompress.com/\](https://jscompress.com/) Fails onclass Helpers {
[https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced:Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t))
Note[n,t]
needs to be([n,t])
Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
That's why I write my code uglified and minified to begin with ;p
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
-
Tim Carmichael wrote:
if there was some way to compile it...
Isn't that what WebAssembly is all about? (and now, being aware of that name's existence, you know as much about WebAssembly as I do)
Yes, that is exactly what WASM is all about. MDN has done its usual due diligence and added several sections about it: [WebAssembly | MDN](https://developer.mozilla.org/en-US/docs/WebAssembly)
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
-
That's why I write my code uglified and minified to begin with ;p
Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Plus it's fun to watch co-worker eyes cross, I imagine.
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli
-
Having never heard of a 'minifer', I followed the link that you said worked; OK, I understand what they are now. The next question is: does the page/site load noticeably faster when using the 'minifer'ed version? If so, what percent increase was seen?
-
So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on
class Helpers {
[https://jscompress.com/\](https://jscompress.com/) Fails onclass Helpers {
[https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced:Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t))
Note[n,t]
needs to be([n,t])
Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
What is the actual size being transmitted? Since web traffic is / can be compressed by default, is it worth doing "minify" explicitly? (i.e. is it redundant when considering compression).
"(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal
-
What is the actual size being transmitted? Since web traffic is / can be compressed by default, is it worth doing "minify" explicitly? (i.e. is it redundant when considering compression).
"(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal
Zipping the raw js vs. the minified js resulted in 17K and 9K respectively, so even if the web traffic is compressed, it's still ~50% reduction. At least, in my one little test!
Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
Zipping the raw js vs. the minified js resulted in 17K and 9K respectively, so even if the web traffic is compressed, it's still ~50% reduction. At least, in my one little test!
Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on
class Helpers {
[https://jscompress.com/\](https://jscompress.com/) Fails onclass Helpers {
[https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced:Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t))
Note[n,t]
needs to be([n,t])
Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802