User Tag List

Results 1 to 9 of 9

Thread: Parent loop conditions surprisingly don't seem to be faster.

  1. #1
    Clicker Fusion 2.5

    Join Date
    Jul 2006
    Posts
    239
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Parent loop conditions surprisingly don't seem to be faster.

    My thoughts were since loop conditions check a string, they'd be a significant cost. If the check happened as the top level of a parent event, it would only have to check the string once and be faster. Turns out it's roughly the same speed as flat/"normal" events. That means either 1. The loop name string is rechecked for every child event, or 2. I'm wrong about loops and their names are compiled so they're almost instant. I assumed they weren't compiled since they're calculations, but it would be useful to know if they are and I don't have to worry about them.


    Application 1.mfa

  2. #2
    Clicker Install 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)
    Darkhog's Avatar
    Join Date
    Jan 2009
    Location
    /dev/null
    Posts
    485
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Thing is, that even if they're not really faster, you should still do it for purely organizational reasons, so e.g. if you make a typo in the loop name and decide to fix it later (or decide to rename it for any other reason) you don't have to change several events that are part of the loop, just one.

  3. #3
    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
    3,019
    Mentioned
    133 Post(s)
    Tagged
    0 Thread(s)
    I've found similar things, but not with loops, but with regular conditions (eg. Compare alterable value). I expected merging similar events into a parent loop would speed things up by eliminating redundant checks, but it didn't. IIRC, Yves said that using child loops was faster only if the child conditions referenced different objects than the parent conditions.

  4. #4
    Clicker Install 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)Firefly 3D Module (Steam)
    defisym's Avatar
    Join Date
    Jun 2017
    Location
    Asia
    Posts
    510
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Might because the cost of child events counteract the cost of string comparison. Even the tradition compare method is O(n), the best case is O(1), just compare the length, as fusion just need to check if loop name equals, not need to find the first occurrence of a pattern.
    Also, as for immediate events, all of these type are checked during one call. That is to say, all on loop are checked, all of their names are checked, and the iterate also cost time. Don’t know if fusion has some optimization for static loop names internally but this is the case of extension.

  5. #5
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    680
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I recall a mention that fast loop names are actually optimised out if they are static (i.e. the fast loop's name is just one string, not an expression), so internally there is no string comparisons happening for those loops.

    You can test this theory out by using "On loop 'MyFastLoopName("Active")' which will force Fusion to make a string comparison for this loop event.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  6. #6
    Clicker Fusion 2.5

    Join Date
    Jul 2006
    Posts
    239
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I guess the compile optimization could also group all loop conditions into 1 call, but that would only work if they're not a calculation.

  7. #7
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,569
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yeah there was an optimization several years ago to make fast loops with static strings use a direct reference instead of a string comparison reference, so there's no string comparisons going on if you're calling a static named loop from a static named call.

  8. #8
    Clicker Fusion 2.5 (Steam)
    Linky's Avatar
    Join Date
    Mar 2020
    Location
    Egypt
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BartekB View Post
    I recall a mention that fast loop names are actually optimised out if they are static (i.e. the fast loop's name is just one string, not an expression), so internally there is no string comparisons happening for those loops.

    You can test this theory out by using "On loop 'MyFastLoopName("Active")' which will force Fusion to make a string comparison for this loop event.
    Yeah can confirm that it's slower when done like that, so Fusion most likely does it's optimizations on static loop names
    On my tests it was around 50% slower (even if the string remained unchanged)!

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleSWF Export Module

    Join Date
    Jun 2014
    Posts
    112
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It also should be noted that the latency of calculated "on loop" conditions doesn't seem to affect calculated "start loop" actions. It's only the "on loop" name that needs to be static.

Similar Threads

  1. Loop conditions in EDIF?
    By GamerH2 in forum Extension Development
    Replies: 4
    Last Post: 24th August 2017, 05:14 PM
  2. Loop question for conditions
    By Bree in forum Fusion 2.5
    Replies: 9
    Last Post: 30th January 2017, 10:17 PM
  3. Conditions within a loop?
    By kons in forum Fusion 2.5
    Replies: 4
    Last Post: 22nd December 2015, 07:16 PM
  4. Faster Fast Loop Movement......in Flash
    By Eliyahu in forum SWF/Flash Export Module Version 2.0
    Replies: 8
    Last Post: 28th January 2011, 09:34 PM
  5. Faster Than A Fast Loop?
    By variant in forum Multimedia Fusion 2 - Technical Support
    Replies: 22
    Last Post: 9th February 2010, 05:44 AM

Posting Permissions

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