Re: 'Flavors' of JS?
"Brian Genisio" <BrianGenisio@y ahoo.com> wrote:[color=blue]
> This assumes you have a fast computer. I suppose it all depends on your
> audience, but the average computer user these days does not have
> anything better than a 300 Mhz PC with 64 MB of memory. Many people
> have much slower machines yet.[/color]
Even still, a difference of 5k in library size is negligible. I have some
200mhz machines here I can test with, I should run some comparisons, just to
see for sure what the difference is.
[color=blue]
> By always thinking about efficiency,
> optimization is rarely necessary.[/color]
I agree, and I do consider efficiency (caching objects and references to
objects, etc). My point is, when a script runs fine and there are no
complaints, spending an hour to squeeze out .0001s better speed is not time
well spent.
[color=blue]
> Of course, 1 second faster seems
> silly, but what if is a 1 second improvement from something that takes
> 1.1 seconds?[/color]
Over 10,000 iterations?
That's a speed increase for a single iteration (typical) from .0011 seconds
to .00001 seconds, which is completely unrecognizable. If the code is
actually going to be executed 10,000 times, then that's a different story
(and probably a design flaw ;)
I doubt anything is going to actually be executed 10,000 times in
javascript. If it is, there's probably something wrong. But many people who
I see tweaking for speed increases actually have to run something thousands
of times in a loop to even measure the difference in execution time. If it's
only going to run oncec or twice, and you need to run it 10,000 times to see
a speed increase, then it's not a practical exercise.
[color=blue]
> If you really think that speed optimizations are a huge waste of time,
> then you have never written an application of any substance.[/color]
I never say the former, and I certainly have done the latter!
My belief is that speed optimizations are not the best use of a develoepers
time if the speed increase is so small so as to not even be noticed, and if
a block of code needs to be executed 10,000 times in order to notice a 1
second speed increase, then the time spent optimizing could be better spent
somewhere else.
[color=blue]
> Ok, I will get off my high horse... It is just that I get sick of having
> to find effiency problems in code after the fact (From me, or from other
> developers).[/color]
I'd much rather deal with slightly inefficient code than code that isn't
commented and is poorly designed to begin with. I'll gladly sacrifice .1
seconds of speed in exchange for code clarity :)
--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
"Brian Genisio" <BrianGenisio@y ahoo.com> wrote:[color=blue]
> This assumes you have a fast computer. I suppose it all depends on your
> audience, but the average computer user these days does not have
> anything better than a 300 Mhz PC with 64 MB of memory. Many people
> have much slower machines yet.[/color]
Even still, a difference of 5k in library size is negligible. I have some
200mhz machines here I can test with, I should run some comparisons, just to
see for sure what the difference is.
[color=blue]
> By always thinking about efficiency,
> optimization is rarely necessary.[/color]
I agree, and I do consider efficiency (caching objects and references to
objects, etc). My point is, when a script runs fine and there are no
complaints, spending an hour to squeeze out .0001s better speed is not time
well spent.
[color=blue]
> Of course, 1 second faster seems
> silly, but what if is a 1 second improvement from something that takes
> 1.1 seconds?[/color]
Over 10,000 iterations?
That's a speed increase for a single iteration (typical) from .0011 seconds
to .00001 seconds, which is completely unrecognizable. If the code is
actually going to be executed 10,000 times, then that's a different story
(and probably a design flaw ;)
I doubt anything is going to actually be executed 10,000 times in
javascript. If it is, there's probably something wrong. But many people who
I see tweaking for speed increases actually have to run something thousands
of times in a loop to even measure the difference in execution time. If it's
only going to run oncec or twice, and you need to run it 10,000 times to see
a speed increase, then it's not a practical exercise.
[color=blue]
> If you really think that speed optimizations are a huge waste of time,
> then you have never written an application of any substance.[/color]
I never say the former, and I certainly have done the latter!
My belief is that speed optimizations are not the best use of a develoepers
time if the speed increase is so small so as to not even be noticed, and if
a block of code needs to be executed 10,000 times in order to notice a 1
second speed increase, then the time spent optimizing could be better spent
somewhere else.
[color=blue]
> Ok, I will get off my high horse... It is just that I get sick of having
> to find effiency problems in code after the fact (From me, or from other
> developers).[/color]
I'd much rather deal with slightly inefficient code than code that isn't
commented and is poorly designed to begin with. I'll gladly sacrifice .1
seconds of speed in exchange for code clarity :)
--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
Comment