User Tag List

Results 1 to 4 of 4

Thread: A Slow Fast Loop... Or Bad Coding?

  1. #1
    No Products Registered

    Join Date
    Oct 2009
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A Slow Fast Loop... Or Bad Coding?

    Okay, here is the problem I am having with my fast loops, type or paste a large amount of text into the top text area, then click "Go!". You will notice that the application will sort of freeze, and after a long while the output text will finally be visible. I do not know what I did wrong, I coded it efficiently as possible, at least as far as I know. Related to this post.

    -Variant
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Ryan's Avatar
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    1,279
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: A Slow Fast Loop... Or Bad Coding?

    Yes, making constant changes to an edit box during a fast loop is slow. What you should do is make a global string variable, edit/append data to the global string variable in the fast loop, then copy it to the edit box after the loop.

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: A Slow Fast Loop... Or Bad Coding?

    Yep, checked out the code and problem is you're using an immutable string type. Each it appends a string by doing:


    "set text of edit box = string + %"


    it does this not by altering the existing string, but rather by creating an entirely new string and setting its value to this result. So each append action constructs a new string, of length of the current result. So for the entire thing, you'll end up using (# of loops) * (length of output / 2) size of string objects. I think ryan is correct that global strings are mutable and thus you could edit them with little slowdown, but I personally use the binary data object

  4. #4
    No Products Registered

    Join Date
    Oct 2009
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: A Slow Fast Loop... Or Bad Coding?

    The percent (%) sign is a delimiter, I'm not really sure how that would work, but I'll try it, thanks.

    -Variant

Similar Threads

  1. Detect if device is slow or fast
    By Popcorn in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 8th March 2013, 12:37 PM
  2. fast loop and loop index
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th May 2010, 01:43 AM
  3. Fast loop within fast loop - platform game
    By Safe in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 16th April 2010, 07:38 AM
  4. Why are fast loops so slow?
    By Pixelthief in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 25th September 2008, 12:13 AM
  5. Fundamental coding question: loop, restrications..
    By Leander in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 27th September 2007, 03:12 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
  •