From: Jorge on
On Jan 16, 12:00 am, Scott Sauyet <scott.sau...(a)gmail.com> wrote:
> On Jan 14, 5:03 pm, Scott Sauyet <scott.sau...(a)gmail.com> wrote:
>
> > If I find some time tonight or tomorrow, I'll do a few more thorough
> > benchmarks of multiple versions of the algorithms and see what the
> > main issues are.
>
> I found a little time to run a number of tests, but I don't have time
> now to analyze them.  Anyone interested in seeing the raw data from
> JSLitmus tests in five browsers running against lists with 10, 100,
> 1000, and 10000 elements can see my results, and run their own tests
> here:
>
>    http://scott.sauyet.com/Javascript/Test/LoopTimer/3/
>
> Note that FF seems extremely inconsistent, which makes me worry about
> how it's interacting with JSLitmus.  The runs shown here seem fairly
> representative, though.  All the other browsers seem fairly
> consistent.  The raw data (as a PHP array) is here:
>
>    http://scott.sauyet.com/Javascript/Test/LoopTimer/3/results.phps
>

If your intention is to time with accuracy what comes inside the for
loop, you ought to set library.length to a (much) big(ger) number: you
want the time spent inside the loop to be as close to 100% of the
total time as possible. Iterating a million times over the whole thing
with a badly chosen (small) library.length won't give you any added
accuracy in this regard.

That's why, for example, in the Safari row, you get these completely
different results:

library.length: 10 (items) 10k (items)
pushLookupIncrement: 375,6k 537
pushNewVarIncrement: 622,6k (1,65x) 1.3k (2,42x)

For the faster is the loop is, the bigger the % of error that a small
library.length introduces.

Also, looping through 10000 items, ought to take ~ 1000 times as long
as looping through 10 items, and that's not what your results show:
622,6k !== 1.3k*1000. That's too due to the error I'm talking of: the
10k items result is more accurate and the 10 items figure is off by
100-(622,6/13)= a 52.1% (an error quite big !, the real figure for 10
items was more than 2x that !)

And, as the loop of each tested f() takes a different amount of time
to execute, it's getting a different % of error... (That's the reason
why there's a JSLitmusMultiplier in my (modified) JSLitmus.js)
--
Jorge.
From: Scott Sauyet on
On Jan 15, 8:25 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de>
wrote:
> Scott Sauyet wrote:
>> You're getting as pedantic as Thomas is, here.
>
> By contrast, I am being *precise*, stupid.

| 2. overly concerned with minute details or formalisms, esp. in
teaching

- http://dictionary.reference.com/browse/pedantic

Or another way of putting it, being overly precise.

If it's an insult, it's a much more mild one than "stupid". :-)

-- Scott
From: Scott Sauyet on
On Jan 16, 7:14 am, Jorge <jo...(a)jorgechamorro.com> wrote:
> On Jan 16, 12:00 am, Scott Sauyet <scott.sau...(a)gmail.com> wrote:
>>    http://scott.sauyet.com/Javascript/Test/LoopTimer/3/results.phps
>
> If your intention is to time with accuracy what comes inside the for
> loop, you ought to set library.length to a (much) big(ger) number: you
> want the time spent inside the loop to be as close to 100% of the
> total time as possible. Iterating a million times over the whole thing
> with a badly chosen (small) library.length won't give you any added
> accuracy in this regard.

Well, as I said, I haven't had time to post any analysis. And I still
don't.

But that's not what I'm trying to compare. The raw numbers aren't
comparable across the rows. That wouldn't make sense; in an ideal
world, they would fall by approximately a factor of ten at each
column. The main thing is to see how the different algorithms perform
at various array lengths in the different browsers. Here Safari is
quite consistent. At all array lengths, the final two algorithms are
the fastest, followed by the third and fourth, then the fifth and
sixth, with the first and second trailing far behind.

I think there is something to be gleaned from these examples, but it
will take me a little more time to digest it.

-- Scott
From: Jorge on
On Jan 16, 2:07 pm, Scott Sauyet <scott.sau...(a)gmail.com> wrote:
> On Jan 16, 7:14 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>
> > If your intention is to time with accuracy what comes inside the for
> > loop, you ought to set library.length to a (much) big(ger) number: you
> > want the time spent inside the loop to be as close to 100% of the
> > total time as possible. Iterating a million times over the whole thing
> > with a badly chosen (small) library.length won't give you any added
> > accuracy in this regard.
>
> But that's not what I'm trying to compare.

Funny, as the loop is what makes them different.

> The raw numbers aren't
> comparable across the rows. That wouldn't make sense;

I thought the sole purpose of the tests was to compare the results :-)

> in an ideal
> world, they would fall by approximately a factor of ten at each
> column.

Only if/when the time spent in the loop is closer to 100% of the total
execution time.

> The main thing is to see how the different algorithms perform
> at various array lengths in the different browsers.
> Here Safari is quite consistent. (...)

Surprise surprise, increase a little bit library.length to e.g. just
2e4 items and see what happens then.
--
Jorge.
From: Thomas 'PointedEars' Lahn on
Scott Sauyet wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Scott Sauyet wrote:
>>> You're getting as pedantic as Thomas is, here.
>>
>> By contrast, I am being *precise*, stupid.
>
> | 2. overly concerned with minute details or formalisms, esp. in
> teaching
>
> - http://dictionary.reference.com/browse/pedantic
>
> Or another way of putting it, being overly precise.

And I do not think I have been *overly* precise. I just would not accept my
words being twisted by wannabes. If you think that to be pedantic, so be
it.

> If it's an insult, it's a much more mild one than "stupid". :-)

Fair enough :) It is too often *used as* an insult, so I guess I have grown
a bit allergic to it. Sorry.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>