User Tag List

Results 1 to 10 of 10

Thread: Child events seem to be significantly slower than regular events

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,306
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)

    Child events seem to be significantly slower than regular events

    I've noticed a number of times since getting that putting things into child events seems to slightly slow down performance compared to leaving things as regular, non-hierarchical events. Of course, one would assume that the opposite is true, since part of the purpose of child events is to save Fusion from having to repeatedly check the same conditions over and over.

    I built a quick test today (attached) and, unless I made a mistake somewhere in the code, the results are concerning. On my PC at least, the old method of events blows child events out of the water in terms of performance. The test uses the Microtimer extension to measure performance in microseconds. Using the built-in profiler also shows child events to be slower (though the difference is less pronounced according to the profiler). Is this a known issue and, if so, is it being worked on?


    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall CreatorInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Aug 2006
    Location
    France
    Posts
    1,179
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    Clicker Fusion 2.5Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    787
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)
    Hmm concering, i have some memory that this was raised during the beta/initial release and I think someone on the dev team said it depended on what was being done in the event? I might be wrong though.

  4. #4
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,336
    Mentioned
    156 Post(s)
    Tagged
    2 Thread(s)
    Interesting example, that shows 2 different things:

    1. When objects are selected in parent events, Fusion has to restore the object selection for each child event that use them, this may take time, given the way object selection is coded in Fusion. Child events that don't use objects that are specified in their parents are faster. There is also a bit more code to process parent/child event hierarchy, but I think it's less significant.

    2. When the "Optimize Events" option is selected, Fusion can optimize the evaluation of some conditions, it can't do that if you dispatch those conditions in separate event lines.

    If you unselect the "Optimize Events" option, you'll see the difference is smaller, this will show you the time taken by point #1. The remaining part is the time that "Optimize Events" allows to save.

    PS: the "Optimize Events" option also allows to save lot of time in On Each Object loops, and this optimization is not possible if you use a unique "On Each Object" parent event with lots of child events, this one is in the todo list as the On Each optimization made by Optimize Events is really important. I think it has been already reported.

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,306
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)
    Very useful information, Yves!

    Quote Originally Posted by Yves View Post
    1. When objects are selected in parent events, Fusion has to restore the object selection for each child event that use them, this may take time, given the way object selection is coded in Fusion. Child events that don't use objects that are specified in their parents are faster. There is also a bit more code to process parent/child event hierarchy, but I think it's less significant.
    Indeed, when I changed the events so that each level of the hierarchy referenced different objects, child events shot into the clear lead! Without referencing their parents' objects, I think child events lose some of their usefulness, but still, very good to know!



    2. When the "Optimize Events" option is selected, Fusion can optimize the evaluation of some conditions, it can't do that if you dispatch those conditions in separate event lines.
    Interesting. I don't know what this means, but when I uncheck "Optimize Events" the differences falls from about ~60% faster to about ~40% faster.....but if I change the framerate from 60 to 1000, then unchecking "Optimize Events" drops from about ~50% faster to only ~2% faster!



    PS: the "Optimize Events" option also allows to save lot of time in On Each Object loops, and this optimization is not possible if you use a unique "On Each Object" parent event with lots of child events, this one is in the todo list as the On Each optimization made by Optimize Events is really important. I think it has been already reported.
    Yes, by @caslizero if I remember correctly

  6. #6
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,336
    Mentioned
    156 Post(s)
    Tagged
    2 Thread(s)
    I tested something else in your example.

    Another important factor is the number of objects that are involved. In your example there is only one instance of each object. Saving / restoring the object selection takes some time, but this time proportionally decreases as the number of objects increases and at some point it becomes faster to restore the object selection than re-selecting objects in normal conditions.

    Take your example and duplicate 6 times each object. You'll see that the child event version is now faster than the normal version.
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,306
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)
    ah, good to know!

  8. #8
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,336
    Mentioned
    156 Post(s)
    Tagged
    2 Thread(s)
    Actually I tested with the debug version of Fusion and the speeds are not the same, the 6-object version is about the same speed, not faster.

    Though, something weird, I made the same example after adding new objects and then removing them and when I got back to 6 objects child events are now 50% faster. Err... can you spot the difference between both examples?
    Attached files Attached files

  9. #9
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,336
    Mentioned
    156 Post(s)
    Tagged
    2 Thread(s)
    Err, I'm lost, now the 2 examples I've posted run at the same speed and child events are faster in both cases, not sure what happened when I tested the first one, forget my post just above.

  10. #10
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,306
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)
    Well all the tests I've run have been very variable. 'normal' events might be 80% faster one time, and then 35% faster a few seconds later. And as I mentioned earlier, changing the framerate makes a big impact (in this case, maybe child events was faster by 4% one time, and 'normal' events faster by 8% another time). I guess even with 6 copies of the objects, we're still talking about very small timescales, (~1 or 2 milliseconds) so the margin for error (or the OS or some background program getting in the way and slowing things down) is probably pretty high.

Similar Threads

  1. Breaking Out Of Child Events
    By grimmy in forum Fusion 2.5
    Replies: 3
    Last Post: 25th September 2019, 12:34 PM
  2. 2.5+ Parent & Child events: When to use it?
    By Fuuriokun in forum Fusion 2.5
    Replies: 14
    Last Post: 24th April 2019, 12:05 PM
  3. Simple Toggle Problem - Child events
    By grimmy in forum Fusion 2.5
    Replies: 3
    Last Post: 22nd April 2019, 01:49 AM
  4. Correct way of doing child events in order
    By elvisish in forum Fusion 2.5
    Replies: 16
    Last Post: 13th April 2019, 03:34 PM
  5. Is running events through qualifiers faster then regular?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 11th January 2013, 12:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •