100000 changes of PV

This forum is currently in read-only mode.
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • In this CAP there's measured speed of every frame with 100000 outside layout in two modes:

    no actions on objects

    increment every object's PV

    IMO foreach-ing works fast enough. Enjoy ^^.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • Second test: Add TimeDelta vs Creation Time.

    Goal: the most efficent way to access every object's "Age".

    Methods:

    Add TimeDelta always add TimeDelta to ('time'). Retrieving "age": Object('time')

    Set Creation Time sets ('creation') at Start Of Layout. Retrieving "age": Timer - Object('creation')

    First method does:

    always add to PV (nobjects) times

    always retrieve PV (nobjects * n) times

    Second method does:

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)