In response to CaptFalcon33035
Operators are much faster than procedures, and to prove that, I give you stats:

var/list/stuff=list()
mob/verb/test()
world<<"STARTING"
for(var/i=1 to 10000)
stuff+="LOL"
world<<"DONE"

Results:
|     Proc     |Self CPU Time|Total CPU Time|Real Time|Calls|
|/mob/verb/test| 0.060 | 0.060 | 0.060 | 1 |



var/list/stuff=list()
mob/verb/test()
world<<"STARTING"
for(var/i=1 to 10000)
stuff.Add("LOL")
world<<"DONE"

Results:
|     Proc     |Self CPU Time|Total CPU Time|Real Time|Calls|
|/mob/verb/test| 0.170 | 0.170 | 0.170 | 1 |


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.
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

Did you also know that using for(var/i=1,i<=10000,i++)
is faster than using for(var/i=1 to 10000)?

And did you know that
for(var/i=1,i<=10000,++i)
is faster yet?
In response to PirateHead
PirateHead wrote:
CaptFalcon33035 wrote:
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)?

And did you know that
for(var/i=1,i<=10000,++i)
is faster yet?

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:
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)?

And did you know that
for(var/i=1,i<=10000,++i)
is faster yet?

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?
Page: 1 2