sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Ruby performance wierdness.

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 270 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      CPhillips
      last edited by

      I am experiencing some weird behavior out of Ruby and I wonder if someone has any idea what is going on. Using my SketchyFFD plugin if I weight a large model (11k verts) the first time it takes 17 seconds, the second time 13 seconds and the third 7 seconds. Exact same code exact same model. WTF?

      Also an array.each over 11k elements gets slower and slower as the loop gets near the end. The first 1000 take a second but the last 1000 takes about 12 seconds. Again WTF?

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        @cphillips said:

        Also an array.each over 11k elements gets slower and slower as the loop gets near the end. The first 1000 take a second but the last 1000 takes about 12 seconds. Again WTF?

        I've seen this behavior in creating new groups. The fist thousand zip by under 1 second. The next 1000 take over 2 seconds, the next over 8 seconds, then 16, then 40, on and on. In this particular case, I'm fairly confident it is how SU is handling the ability to make groups, when it already has many groups in the model. Because making 1000 groups in the model w.o any other groups in the model, takes under 1 second. But making only 1000 groups if the model already has 10,000 groups takes over a minute for just 1,000 groups.

        So perhaps its not related, but maybe it is. I just thought I'd mention that I'd seen similar. And I tried many things to get the speed to improve, but SU was decidely not going to do it.

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • daikuD Offline
          daiku
          last edited by

          Just some guesses: The increased performance on subsequent runs could be due to cacheing. And decreased performance on large arrays could be caused by exhausting an available memory pool (runs fast until that point), and the overhead associated with allocating more (runs slow from there). CB.

          Clark Bremer
          http://www.northernlightstimberframing.com

          1 Reply Last reply Reply Quote 0
          • C Offline
            CPhillips
            last edited by

            After doing some more testing I have narrowed it down a bit further. Part of the problem seems to be in the undo system. Code that runs between operation_start and operation_commit slows down much more than code runs outside.

            I have a loop that moves all the verts in a group. With 11k verts a run takes 68 seconds if I use start/commit and about 6 seconds without.

            But there is still something else going on. The second run is always at least 2 times faster. Even with start/commit where it takes 68 seconds the second run is 9 seconds.

            Argh!

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              Are yuo using the new start_operation parameters for version 7?

              model.start_operatation "My Op" true

              That true will speed up the undo stack a bit. But again, the extra parameter works in SU7, so you have to throw in a version check and only apply that true parameter to users who are in SU7.

              Chris

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              1 Reply Last reply Reply Quote 0
              • C Offline
                CPhillips
                last edited by

                No I wasn't. I had forgotten about that. It helps a quite a bit 68 sec without, 11 sec with, and 6 sec if no start/commit used.

                But still first run 11 sec and second run it only takes 2 sec.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement