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

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • 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.


    Please login to see this attachment.

  • 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.

    There are no impossible things, there is only lack of skill needed to complete the task.

  • 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.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • 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.

  • 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

    Join the Click Converse Discord! - Please login to see this link.

  • 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)!

    Game/App developer, artist and a community contributor.
    You can support my work on: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!