1
2
In response to Crashed
|
|
The example Crashed gave me works perfectly! thanks guys
|
In response to Crashed
|
|
0.0
Did you also know that using for(var/i=1,i<=10000,i++) is faster than using for(var/i=1 to 10000)? |
In response to CaptFalcon33035
|
|
CaptFalcon33035 wrote:
0.0 And did you know that for(var/i=1,i<=10000,++i) |
In response to PirateHead
|
|
PirateHead wrote:
CaptFalcon33035 wrote: for(var/i=1,i<=10000,++i) Know what's even faster than that? for(var/i=1,i<=10,++i) Ha! |
In response to Crashed
|
|
if you want to test the speed of a function, call it more than once, try more like 100,000 calls.
|
In response to OneFishDown
|
|
He did call it more than once. He called it 10,000 times.
|
In response to PirateHead
|
|
PirateHead wrote:
CaptFalcon33035 wrote: for(var/i=1,i<=10000,++i) I don't see how (i=1,i<=10000,i++) would be any faster than (i=1 to 10000). In fact, if there were any difference at all I would have assumed it to be the other way around since the "a to b" format can only increment one way whereas "init, check, action" format can do more and would therefor require more checks if anything. As for ++i being faster than i++, is any difference there really noticable even on a large scale? |
1
2
Results:
Results:
That's nearly three times faster. In conclusion, use the operators for single objects, and the procedures for multiple ones (Even though using two operators would be faster, it's the right thing to do).
Edit: You probably won't get those high times like I did because I'm running on a slow machine. AMD 3D-k6 470MHZ 56MB RAM.