|
-
some very strange var benchmark.
Hello,
I wanted to show some benchmarks, because i don't understand why these are the results i get:
in class Ship:
Code:
public var wwidth:Number = width;
then:
doing all of these 10000 times, gives this:
craft.x; //11 ms
craft.width;//102 ms
craft.wwidth //1 ms
I cannot believe the amazing difference in performance of this.
And in terms of performance, this means that you can better use a var wwidth, like i did here, as long as your mc doesn't change inn size.
-
Señor Member
Going across scope levels takes a lot longer because flash has to do a cross-class look up each time. Setting it to a local variable really improves performance for that reason.
Haikus are easy
But sometimes they don't make sense
Refrigerator
-
uhm. there isn't a local variable among these three, is there? i don't think i know what you mean.
-
When you call .width it's measuring the size of the object every time - with wwidth you only measure once and then the number is frozen so it's just a memory read.
-
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|