473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

When to minify?

How much javascript would you have when you decide that minifying is
called for?
Nov 14 '08
50 3816
On Nov 20, 5:12*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
David Mark wrote:
>The answer to "when to minify" is: right before you start
>testing the script. [...]
Right. *And when the test fails, you go fix the bug ... wait a
minute, *you can't*.
And why on earth not?
Well, let's say testing shows that there's an error in line 42 of
the minified code that you want to fix. *You could attempt to
beautify the minified code again and then compare with the original
non-minified code, but, to begin with, how can you know that even
the lines numbers are the same then?
[...]
For one, save the original (obviously.)
When you can't be sure whether the error that occurred in the minified
code also occurs in the original code in the first place, or the
problem is the result of the minifying instead, saving the original
code is not of much help when finding a problem in the minified code.
Perhaps you are just snake-bit,

Sorry, I don't follow.
Perhaps you have had bad luck.
>
but I have never found such an error.

That does not mean anything.
In the original context it did.
>
Before testing, I run the code through JSLint and then the YUI
"minifier." *Invariably, the code runs exactly as before. *If it ever did
not, I would find the problem easily enough. *Thanks for your concern
though.
>For two, who debugs by line number?
OK, so how do you suggest to debug a one-liner that is the result of
the minifying of, say, 500+ LOCs? *And even if you could do that
*always*, I
What difference does it make how many lines of code there are (if you are
not debugging by line number?)

The debuggers that I have encountered so far work line-based (e.g., set a
breakpoint on or go to line #n, not statement #n). *There are a few that can
beautify the code before debugging to make debugging easier (among them
Venkman), but not all.
The debuggers I have always used show you the code in question. Some
better than others. For IE, you need Visual Studio (or InterDev or
whatever.)
>
seriously doubt you can look at one example of p,a,c,k,e,d code junk
and
Nobody, but nobody, uses that stupid p,a,c,k,e,r.

Experience and Google hits disagree. *There are 1'620 Google hits for
'"p,a,c,k,e,r" javascript", 1'930 for '"p,a,c,k,e,d" javascript'
as of today.
And what are those hits? Scripts by nobodies? See how many hits you
get for userAgent.
>
What makes you think I use it?

I did not imply that. *You deem yourself to be too important.
tell me at once which identifier in it means which in the original
code, because obfuscation is one result of this kind of minifying.
Again, there is no need to track down bugs in the minified code. *If
there ever were, perhaps I would get a new minifier.

You cannot know that. *You said before that you tested the *minified* code.
*But that code differs from the original code. *So you cannot know (until it
is too late) that minifying caused you additional problems.
Then we have the issue of semicolon insertion or parenthesizing that
needs to be done explicitly in minified code but not in the original
code. *And probably I have forgotten something else.
I already covered that (JSLint.) *(The semicolons, etc., not whateveryou
forgot.)

JSLint has problems of its own, as has been demonstrated recently. *Suffice
Not related to this. (!) Yeah, there is some new superfluous message
about creating functions in a loop. I've seen it and I actually re-
factored a loop to shut it up. So what?
it to say that even JSLint cannot recognize when parenthesizing or explicit
semicolon insertion was necessary in the minified version of the analyzed
code, because that is not only a matter of syntax, but also of semantics.
You seem to have it backwards. Run JSLint first and it will tell you
where you mistyped. End of story.
Nov 20 '08 #51

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: sql-db2-dba | last post by:
Does DB2 just fudge it when it is an empty table? Is there a "formula" for average row size when you have variable length records. Or you really have to know what your application is packing into...
4
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a...
5
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
32
by: David Mark | last post by:
I've got a collection of functions that accept a function or object (paired with a method name) as a callback. For the longest time I have relied on this test. (typeof cb == 'function') ...
0
by: shapper | last post by:
Hello, Does anyone knows any C# Library to Combine and Minify CSS and Javascript files? I was able to find a few Rails and Java tools but no .NET tool. This would be really useful for ASP.NET...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.