Re: Here's a Python-like range() for JavaScript. Is it new?
- From: Jonathan Fine <J.Fine@xxxxxxxxxx>
- Date: Fri, 27 Feb 2009 13:57:22 +0000
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
.
- References:
- Here's a Python-like range() for JavaScript. Is it new?
- From: Jonathan Fine
- Re: Here's a Python-like range() for JavaScript. Is it new?
- From: Robin
- Re: Here's a Python-like range() for JavaScript. Is it new?
- From: Jonathan Fine
- Re: Here's a Python-like range() for JavaScript. Is it new?
- From: Thomas 'PointedEars' Lahn
- Here's a Python-like range() for JavaScript. Is it new?
- Prev by Date: Re: Get index of same name input element
- Next by Date: Re: Here's a Python-like range() for JavaScript. Is it new?
- Previous by thread: Re: Here's a Python-like range() for JavaScript. Is it new?
- Next by thread: Re: Here's a Python-like range() for JavaScript. Is it new?
- Index(es):
Relevant Pages
|
Loading