Did you try using Lambda.map in haxe for sake of argument/comparison,
its possible to not use a loop at all, but I guess its really looping
just in more optimal way. For instance I was creating a simple
tweener class the ot]her day, and used Lambda to map the properties
to their new values, its just a concept class so it works but is
v.basic but if anyone wants it to get more grip on mapping i can send
it. Not currently using away, but Rob mentioned he was looking at haXe.
cheer justin
On 26 Jan 2009, at 22:05, simplychaos wrote:
I was wondering if there are any plans to use linked lists for
iterating through all the various meshes, primitives, lights, etc... ?
It seems like Dictionary is used for everything, but according to my
speed tests linked lists are quite a bit faster. I'm not sure how much
of a boost it would really give but for 5,000,000 iterations here are
my numbers:
linked list: 37ms
for loop: 67ms
dictionary: 179ms
while: 38ms
Here's the iteration code I'm using: The array, linked list, and
dictionary are already built before timing. obj is a typed variable
that has a "nxt" variable to point to the next object in the list.
These numbers are from FP10 release version; numbers are similar with
debug version, but all slightly slower.
var time:uint = getTimer();
for (i=0; i < len; ++i) {
obj = list[i];
}
time = getTimer() - time;
trace("for loop: " + time);
debugText.appendText("for loop: " + time + "\n");
time = getTimer();
obj = list[0];
var val:Number = 0;
while (obj = obj.nxt) { }
time = getTimer() - time;
trace("linked list: " + time);
debugText.appendText("linked list: " + time + "\n");
time = getTimer();
for each (obj in dict) {
}
time = getTimer() - time;
trace("dictionary: " + time);
debugText.appendText("dictionary: " + time + "\n");
time = getTimer();
i = 5000000;
while (i--) {
obj = list[i];
}
time = getTimer() - time;
debugText.appendText("while: " + time + "\n");
This may not have a huge impact, but I thought I'd throw it out there.