100000 changes of PV

Post your own tutorials, guides and demos.

Post » Thu Oct 02, 2008 1:55 pm

In this CAP there's measured speed of every frame with 100000 outside layout in two modes:
:arrow: no actions on objects
:arrow: increment every object's PV
IMO foreach-ing works fast enough. Enjoy ^^.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Thu Oct 02, 2008 2:04 pm

There is no need for a for-each. The event

+ Always
-> Add 'timedelta' to Sprite

adds timedelta to every sprite object. It runs about twice as fast too, since it does them all in one action instead of one at a time and repeating the action!

On the other hand, I'm quite pleased with how fast for-each actually is. It seems to have a fairly low overhead per iteration.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Oct 02, 2008 2:37 pm

Second test: Add TimeDelta vs Creation Time.
Goal: the most efficent way to access every object's "Age".
Methods:
:arrow: Add TimeDelta always add TimeDelta to ('time'). Retrieving "age": Object('time')
:arrow: Set Creation Time sets ('creation') at Start Of Layout. Retrieving "age": Timer - Object('creation')

First method does:
:arrow: always add to PV (nobjects) times
:arrow: always retrieve PV (nobjects * n) times
Second method does:
:arrow: always retrieve PV and do subtraction (nobjects * n) times

In this CAP you can see multiplied events. These are simple operations for accessing "age" data. If you run this now, you'll see that "Creation Time" works better. If you add some of these multiplied events for both methods, you'll see that "Creation Time" loses its advantage, and it becomes worse method for more than 8 retrieves of "age" data.

Still there's nothing to worry since this operations consumes very little amount of processing power.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests