All code on one line?
-
Why do so many people put all their javascript into just one line of code? Is there a noticeable speed increase? I also read that putting comments into your javascript slows it down. Is that really true?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Why do so many people put all their javascript into just one line of code? Is there a noticeable speed increase? I also read that putting comments into your javascript slows it down. Is that really true?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997A minimized javascript file does load faster because it has fewer characters to transmit across the wire. Also why comments are removed, the javascript engine ignores them anyway. That's why you typically see two javascript files, like script.js and script.debug.js. the latter of course being used for debugging situations were it has full comments and formatting for readbility.
I know the language. I've read a book. - _Madmatt
-
A minimized javascript file does load faster because it has fewer characters to transmit across the wire. Also why comments are removed, the javascript engine ignores them anyway. That's why you typically see two javascript files, like script.js and script.debug.js. the latter of course being used for debugging situations were it has full comments and formatting for readbility.
I know the language. I've read a book. - _Madmatt
Unfortunately, the shadowbox source code does not include a "debug" file. They also use single-character variable names. It's virtually impossible to figure out what's being done and what it's doing it to.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997 -
Unfortunately, the shadowbox source code does not include a "debug" file. They also use single-character variable names. It's virtually impossible to figure out what's being done and what it's doing it to.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997A form of obfuscation :-D :-D
I know the language. I've read a book. - _Madmatt
-
Why do so many people put all their javascript into just one line of code? Is there a noticeable speed increase? I also read that putting comments into your javascript slows it down. Is that really true?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997My answer is yes to all your questions. Removing unnecessary characters from javascript is known as minification and it does improve performance (I myself noticed this in one of my projects). Hence by the same logic removing comments will also improve performance. Also this is one of the suggest best-practices by Yahoo.