sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Add_group slow on mac

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    48 貼文 7 Posters 18.2k 瀏覽 7 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Dan RathbunD 離線
      Dan Rathbun
      最後由 編輯

      Well, John, you've proved that disable_ui is much faster that not.

      But the topic is about that add_group and explode group is slow. Which you've also proved, of course, by testing the same entity generation within only 1 group and then exploding it AFTER the loop.

      I only speculated that Sketchup's writing to the Undo stack (and Undo Log file,) might slow things down.

      There is a registry entry on PC for "MaxUndo" (under the "Preferences" key,) which is set to 100 by default. There is no UI control to change this "on-the-fly." (And likely Sketchup would not see any change to the attribute while running.) But I wonder if setting it to 0 before startup would it disable the undo feature all together ?? (I don't know what it's called in the Mac plist.)

      But, regardless, ThomThom believes that it's not the undo stack, but instead the way the app seems to resort the model database, during add groups and explodes.
      What if all the temp groups, were first added to a master group (to separate them from the rest of the model, and then after the loop, the master group was exploded ?)

      I'm not here much anymore.

      1 條回覆 最後回覆 回覆 引用 0
      • Dan RathbunD 離線
        Dan Rathbun
        最後由 編輯

        @dan rathbun said:

        There is a registry entry on PC for "MaxUndo" (under the "Preferences" key,) which is set to 100 by default. There is no UI control to change this "on-the-fly." (And likely Sketchup would not see any change to the attribute while running.) But I wonder if setting it to 0 before startup would it disable the undo feature all together ?? (I don't know what it's called in the Mac plist.)

        I just tried this.. set "MaxUndo" to 0 before SU start.

        The undo operations do NOT appear on the Edit menu.

        Sketchup still writes to the undo log, but after each tool operation, it writes a "Commit(0)" line.

        Changing the attribute back to 100 while Sketchup is running has no effect (as I suspected.) And Sketchup will rewrite it's "live" "MaxUndo" value of 0, back to the registry attribute. So you must change it back to whatever limit you wish, while Sketchup is closed, in order to turn the Undo feature back on.

        I'm not here much anymore.

        1 條回覆 最後回覆 回覆 引用 0
        • Dan RathbunD 離線
          Dan Rathbun
          最後由 編輯

          Also, note. When "MaxUndo" is 0, calling Sketchup.send_action("editUndo:") still returns true, but nothing happens. (At least it does not BugSplat, which I did fear.)

          I'm not here much anymore.

          1 條回覆 最後回覆 回覆 引用 0
          • D 離線
            driven
            最後由 編輯

            @dan rathbun said:

            Well, John, you've proved that disable_ui is much faster that not.

            But the topic is about that add_group and explode group is slow. Which you've also proved, of course, by testing the same entity generation within only 1 group and then exploding it AFTER the loop.

            I only speculated that Sketchup's writing to the Undo stack (and Undo Log file,) might slow things down.
            It appears to here, I can see a cursor image refresh as each group is created

            @unknownuser said:

            There is a registry entry on PC for "MaxUndo" (under the "Preferences" key,) which is set to 100 by default.There is no UI control to change this "on-the-fly." (And likely Sketchup would not see any change to the attribute while running.) But I wonder if setting it to 0 before startup would it disable the undo feature all together ?? (I don't know what it's called in the Mac plist.)

            macSU .plist <key>SketchUp.Preferences.MaxUndo</key><string>100</string>
            I think if you write to, then touch, then read SU uses the update, but I need to check if it works for SU prefs, it does for 'user' ruby ones.

            @unknownuser said:

            But, regardless, ThomThom believes that it's not the undo stack, but instead the way the app seems to resort the model database, during add groups and explodes.
            making a 1000 groups adds 2000 undoes, which is much slower than putting it in the langhandler (which I thought would have a big overhead) with only 1 undo +1 for the explode outside.
            @unknownuser said:

            What if all the temp groups, were first added to a master group (to separate them from the rest of the model, and then after the loop, the master group was exploded ?)
            I'll try and work out a script to do a test, unless you want to...
            I wasn't really doing this to post back, it's just an exercise in me understanding SU ruby (on mac), but the results seemed to be relevant to the OP's mac/group inquiry. Yell at me if it's not.
            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 條回覆 最後回覆 回覆 引用 0
            • D 離線
              driven
              最後由 編輯

              @dan rathbun said:

              Also, note. When "MaxUndo" is 0, calling Sketchup.send_action("editUndo:") still returns true, but nothing happens. (At least it does not BugSplat, which I did fear.)

              One thing I have found when modifying NIB files, is you often need to save, open/close SU then re-save 'manual' preference list changes, to clear SU's cache. Not sure if it's the same with coded writes and maybe it's only the SU ones that are cached?
              john

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 條回覆 最後回覆 回覆 引用 0
              • Dan RathbunD 離線
                Dan Rathbun
                最後由 編輯

                @driven said:

                ... which is much slower than putting it in the langhandler (which I thought would have a big overhead) ...

                The LanguageHandler class has nothing to do with this subject (speed & groups.) It's just a wrapper for a Hash, that has English (the keys,) strings translated to the user's local language.

                Read the "langhandler.rb" file in the "Tools" dir, and you'll see it's quite simple. (I don't use this class, since it defaults to using the "Resources" path, and it's much simplier to just use plain old Hash of my own (which can be loaded from a UTF-8 encoded file.)

                I'm not here much anymore.

                1 條回覆 最後回覆 回覆 引用 0
                • Dan RathbunD 離線
                  Dan Rathbun
                  最後由 編輯

                  For version 8.0M2,
                  @unknownuser said:

                  (http://support.google.com/sketchup/bin/static.py?hl)":1pr50735]SketchUp Writer C++ API: In earlier versions, ISketchUpGroup::CreateGroup became slower each time it was called. This shouldn't slow down any longer.

                  I would think that this fix was added into the application code as well.

                  @Guy: Is your friend's Mac running Sketchup version 8.0M2 ??

                  I'm not here much anymore.

                  1 條回覆 最後回覆 回覆 引用 0
                  • G 離線
                    GWD
                    最後由 編輯

                    @dan rathbun said:

                    For version 8.0M2,
                    @unknownuser said:

                    (http://support.google.com/sketchup/bin/static.py?hl)":100134bg]SketchUp Writer C++ API: In earlier versions, ISketchUpGroup::CreateGroup became slower each time it was called. This shouldn't slow down any longer.

                    I would think that this fix was added into the application code as well.

                    @Guy: Is your friend's Mac running Sketchup version 8.0M2 ??

                    We use on Mac and PC the latest version from google's website. (PC 8.0.11752/MAC 8.0.11.751)

                    I did some more testing:

                    model = Sketchup.active_model
                    entities = model.entities
                    puts '- Start test1 add_group bug on MAC -'
                    start = Time.now
                    for n in 1..1000 do #changed this setting for the testing
                    	g = entities.add_group
                    	g.name = n.to_s
                    	point1 = Geom;;Point3d.new(n*10,0,0)
                    	c = g.entities.add_cpoint point1
                    end
                    puts 'Total time; ' + (start - Time.now).to_s  
                    

                    Results: bugMAC.JPG

                    At this moment we use a workaround. Place the groups in a new model (use the multiple documents on MAC), make a component of all the groups. Save this component and insert it in the model and explode it. The biggest problem of this workaround is that it's impossible to close the new temporary model with ruby. A other problem is that is still a lot slower than on PC.
                    Anybody a solution?

                    1 條回覆 最後回覆 回覆 引用 0
                    • Dan RathbunD 離線
                      Dan Rathbun
                      最後由 編輯

                      WoW! Excellent test report. Shows that the Mac still has a problem.

                      I wonder if the difference has to do with Ruby.? The Mac is still running the initial release of v1.8.5, and the PC was updated to v1.8.6-p287.

                      There is a thread on how to point the symbolic references for Sketchup Ruby to a "normal" full Ruby install elesewhere on the Mac's harddrive. (You need to backup the current links, so you can switch back if necessary. Perhaps a shell script?)

                      I'd be interested in seeing the comparison for the Mac, running v1.8.5-p0 and v1.8.6-p287, ... (and perhaps even the latest patchlevel for v1.8.7)

                      I'm not here much anymore.

                      1 條回覆 最後回覆 回覆 引用 0
                      • G 離線
                        GWD
                        最後由 編輯

                        @dan rathbun said:

                        WoW! Excellent test report. Shows that the Mac still has a problem.

                        I wonder if the difference has to do with Ruby.? The Mac is still running the initial release of v1.8.5, and the PC was updated to v1.8.6-p287.

                        There is a thread on how to point the symbolic references for Sketchup Ruby to a "normal" full Ruby install elesewhere on the Mac's harddrive. (You need to backup the current links, so you can switch back if necessary. Perhaps a shell script?)

                        I'd be interested in seeing the comparison for the Mac, running v1.8.5-p0 and v1.8.6-p287, ... (and perhaps even the latest patchlevel for v1.8.7)

                        And here are the results for ruby 1.8.7 on mac:

                        100 - 0.58 sec
                        200 - 1.69 sec
                        400 - 10.55 sec
                        600 - 33.39 sec
                        1000 - 147 sec

                        Almost no difference with ruby 1.8.5 😞

                        1 條回覆 最後回覆 回覆 引用 0
                        • Dan RathbunD 離線
                          Dan Rathbun
                          最後由 編輯

                          Bummer... definately the problem is in the C++ code.

                          I'm not here much anymore.

                          1 條回覆 最後回覆 回覆 引用 0
                          • J 離線
                            jhauswirth
                            最後由 編輯

                            Looking at the add_group Ruby code, its the same on both platforms.
                            One reason (don't know if this is true) it could be slower on the Mac
                            is the notifications that are sent around could be updating the Mac
                            UI, like the component browser. This may be more efficiently done on
                            the PC.

                            Also, the same code (duplicate code/cut-n-pasted it looks like) that
                            I fixed in the C++ API was also being used in the Ruby code.
                            The bug report only mentioned the C++ API, so that's what got fixed.

                            1 條回覆 最後回覆 回覆 引用 0
                            • thomthomT 離線
                              thomthom
                              最後由 編輯

                              @jhauswirth said:

                              Looking at the add_group Ruby code, its the same on both platforms.
                              One reason (don't know if this is true) it could be slower on the Mac
                              is the notifications that are sent around could be updating the Mac
                              UI, like the component browser. This may be more efficiently done on
                              the PC.

                              I have noticed that if you use Sketchup.status_text within a loop it will be very slow under OSX. It seems that the UI is forcefully freshened all the time, while on Windows you get "white-out" and the UI stops updating - but completes the loop much much faster.

                              But if it is the UI that slows things down, then running the test with start_operation and disable_ui argument set to true, should show a good performance increase, right?

                              Thomas Thomassen — SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 條回覆 最後回覆 回覆 引用 0
                              • Dan RathbunD 離線
                                Dan Rathbun
                                最後由 編輯

                                @John: thanks for taking a look at this, and "weighing in."

                                @GWD: Are all these groups to be added REALLY have all the same objects (like the example,) and just have a different location (transform) ?

                                I'm not here much anymore.

                                1 條回覆 最後回覆 回覆 引用 0
                                • G 離線
                                  GWD
                                  最後由 編輯

                                  @dan rathbun said:

                                  @John: thanks for taking a look at this, and "weighing in."

                                  @GWD: Are all these groups to be added REALLY have all the same objects (like the example,) and just have a different location (transform) ?

                                  Dan,

                                  No this is just a quick test that reproduce the problem. We have at this moment 2 totaly different script which have this problem.

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • G 離線
                                    GWD
                                    最後由 編輯

                                    @thomthom said:

                                    @jhauswirth said:

                                    Looking at the add_group Ruby code, its the same on both platforms.
                                    One reason (don't know if this is true) it could be slower on the Mac
                                    is the notifications that are sent around could be updating the Mac
                                    UI, like the component browser. This may be more efficiently done on
                                    the PC.

                                    I have noticed that if you use Sketchup.status_text within a loop it will be very slow under OSX. It seems that the UI is forcefully freshened all the time, while on Windows you get "white-out" and the UI stops updating - but completes the loop much much faster.

                                    But if it is the UI that slows things down, then running the test with start_operation and disable_ui argument set to true, should show a good performance increase, right?

                                    I tested it with start_operation and it as no effect!

                                    1 條回覆 最後回覆 回覆 引用 0
                                    • G 離線
                                      GWD
                                      最後由 編輯

                                      I just did some testing with adding components instead of groups (see script below). And the result is shokking. Placing 600 component give about the same time as the 600 groups 0.7 sec on PC and 27 sec on MAC. BUT after the script ended the MAC keep on showing the busy icon for very long time. More than 5 minutes (then i killed sketchup). I did the same test on mac with different number of components and this are the results:

                                      50 components 0.29 sec running script 17 sec busy icon after script
                                      100 components 0.85 sec running script 35 sec busy icon after script
                                      200 components 3.8 sec running script 2 min 25 sec busy icon after script
                                      300 components 7.6 sec running script more than 5 min sec busy icon after script
                                      600 components 27 sec running script more than 5 min busy icon after script

                                      require 'sketchup'
                                      UI.menu("PlugIns").add_item("bugMAC Test2") {
                                      model = Sketchup.active_model
                                      entities = model.entities
                                      puts '- Start test1 add_group bug on MAC -'
                                      start = Time.now
                                      for n in 1..600 do 
                                      	newdef = model.definitions.add		
                                      	newdef.name = n.to_s
                                      	point1 = Geom;;Point3d.new(n*10,0,0)
                                      	newdef.entities.add_cpoint point1 
                                      	pt = Geom;;Point3d.new 0,0,0
                                      	trans = Geom;;Transformation.new pt
                                      	i = model.entities.add_instance(newdef, trans) 
                                      	i.make_unique	
                                      end
                                      puts 'Total time; ' + (start - Time.now).to_s  
                                      } 
                                      
                                      1 條回覆 最後回覆 回覆 引用 0
                                      • G 離線
                                        GWD
                                        最後由 編輯

                                        No solutions?

                                        1 條回覆 最後回覆 回覆 引用 0
                                        • Dan RathbunD 離線
                                          Dan Rathbun
                                          最後由 編輯

                                          Not surprising that it takes the same time to add groups and components, because a group is a special type of component, that also has a ComponentDefinition (whose group? attribute is true.)

                                          The extra time, likely comes from adding all that new stuff to the Component browser. (guessing, here.)

                                          Close any unneeded toolwindows, especially the Object browser. And use an operation with the disable_ui flag set.

                                          That's all we can say. I guess John indicated that there were UI issues with the Mac edition. (I'm not sure if he said the SDK updates did, or did not make it into the last build... he was a bit ambiguous. But internal politics, ya know....)

                                          You can always file a bug report. The more people that scream...

                                          I'm not here much anymore.

                                          1 條回覆 最後回覆 回覆 引用 0
                                          • G 離線
                                            GWD
                                            最後由 編輯

                                            Dan, where can i post a bug report?

                                            1 條回覆 最後回覆 回覆 引用 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • 第一個貼文
                                              最後的貼文
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement