Re: Here's a Python-like range() for JavaScript. Is it new?



Thomas 'PointedEars' Lahn wrote:

for (i in array)
vs
length = array.length
for (i=0; i < length; i++)

I said in my original post, I "expect it to be quicker on large ranges, and no slower for small ones". I think this is worth investigating.

There is no reason to believe that it would be quicker.

Well, as I recall, it is quicker in Python, because the test and increment are done by native methods rather than using interpreted code.

So perhaps I'll write a little test. I'm confident that at least one of us will learn something from the outcome.

--
Jonathan
.



Relevant Pages

  • Re: <ctype.h> toLower()
    ... > No the strlen in the loop is not an example that has been made efficient. ... > It's not quicker to run on every implementation, maybe it is if a lookup ... > array is used but then your incurring the overhead of the array. ... > No it doesn't rely on anything imagine it is part of a windows program. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Array and resize
    ... I will check whether this is also a quicker way to create such a matrix ... >> You are not creating a 2D array, but an array containing arrays, and you ... >> can't drop these onto a worksheet in this way. ... >>> Sub DumpValues() ...
    (microsoft.public.excel.programming)
  • Re: 110mph in a 30mph zone!!
    ... but you only need one of the two people involved to think quicker to improve the chances. ... It can think slower due to the boredom of driving slowly. ... I wear a seat belt because it holds me in the correct position when cornering quickly so it's easier to control the car. ...
    (uk.rec.driving)
  • Re: Fun Problem
    ... And now the boot process is notably ... slower. ... On the second reboot I'd bet it runs quicker. ... I've used matched pairs. ...
    (alt.os.linux.suse)
  • Somewhat Dirty Jokes Phase 1 (was Re: ping*Robin)
    ... What's the difference between a hooker, a lover, and a Jewish Wife? ... A hooker says "quicker, quicker", a lover says "slower, slower", a ...
    (alt.support.stop-smoking)

Loading