Commit_operation takes too long

I’ve noticed some of my methods take a very long time to commit operations.

I’m getting very conflicting results on two different computers running Sketchup 2016 and 2017
Could it be due to my graphics driver?

Computer 1

On this computer SketchUp 2017 looks like a major improvement.


SketchUp 2016 (the first benchmark is the time to run the method. the second is the time to commit the operation)

SketchUp 2017

Computer 2 (PROBLEM)

On this computer SketchUp 2017 is a major problem.

SketchUp 2016 (Wow)

SketchUp 2017 (not wow)

On this computer that makes SU 2017 70 times slower. :frowning:

I wish I knew what was causing the slow down. The method does at least all of the following.

  1. Find component instances in the model.
  2. Delete components from within other components.
  3. Create new component definitions and instances.
  4. Add transformations to components.
  5. Glue components to faces in a component.
  6. Select edges and other entities. Add transformation to the selected entities.

Again; everything is done in a single operation. Committing the operation is what takes all the time.

Running the method without an operation is still faster in 2016 than 2017.
2.69 seconds vs. 4.64 second.

are they all from fresh restarts?

I’ve noticed methods before and garbage collection after ‘commit’ are both slower since persistent id arrived…

I’ve got one [270MB skp] at the moment taking 13 seconds to commit and then then 70 minutes before the background cleanup is complete…

john

Yes restarted sketchup, restarted computer, updated video card driver, pulled hair out…

Have you tried adding GC.enable() and/or GC.start() to force Garbage-Collection - into your code - perhaps before the start_operation, within the operation and immediately after it’s committed ?

Makes no difference. And why only on one computer? I tried on two other computers and times are 16-47ms. On the problem computer the time is 1200 ms.

with that much time difference I would suspect interference from another extension or system process…

I often view System Profiler to see what SU is opening and closing while running, but don’t know of a Windows equivalent…

turning off DC, ACT, Trimble Connect and closing Inspector windows almost always boosts performance…

but it is weird it happens on what should be the better computer…

john

Very weird.

Commenting out two lines of code reduces the time from 1171 ms to 59 ms.

This code is called 6 times in the operation.

#ce.add_face p1,p2,p3,p4
#ce.erase_entities ce[4]

I be inclined to use either…

# ants = model.active.entities.to_a
ants.erase_entities( ce[4] )

# or
ce[4].erase!

john

That is a little easier.

Here is a sample model and a stripped down script. The script is too long to paste into the console and must be loaded using load 'c:\path to file\test.rb'

Speed Test.skp (224.8 KB)
Test.rb (32.1 KB)

After opening the model and loading the rb script, run the following in the console to toggle the wainscot height.

BC.wc_height 0
# and toggle it back
BC.wc_height 36

on my dying old iMac…

# BC.wc_height 0 =>
  0.020000   0.000000   0.020000 (  0.021842)
  0.000000   0.000000   0.000000 (  0.002705)
Change Wainscot Height 28 milliseconds


# BC.wc_height 36 => 
  0.020000   0.000000   0.020000 (  0.022512)
  0.000000   0.000000   0.000000 (  0.002657)
Change Wainscot Height 29 milliseconds

BTW: call me old fashion, but using p as a variable never looks right, I changed them all to pt before I even ran it…

john

I tried it on three other computers and they all ran in less than 50ms. I’m not sure what else to check. Is there a way to find out if it’s related to my graphics card?

Would someone with a NVidia GeForce GT 710 running windows 10 be able to test it? I don’t have any other computers with NVidia graphics card.

I tried it multiple times on my mid-2102 MacBook Pro. Best time 19msec, worst 28msec.

I’m beginning to suspect my new computer is ‘broke’!

What anti-virus software do you have installed on the different computers? I’ve in the past had problems with Windows Defender under Win7 slowing things down.

Also, do you have the same set of extensions installed between the two computers you are comparing?

I’m only using windows defender.

I disable windows defender and all extensions. No change noticed. 1.1 to 1.2 seconds.

1 Like

I’m about out of ideas. Sell the computer is the only thing that’s coming to mind at the moment.

But I would like to get to the bottom of this because customers don’t always take kindly to the ‘sell the computer’ fix :wink:

is SU using the nvidia?

the i5 is reported to be better for single thread and internal graphics card, but the i7 using an external card should be better than it as it is with v16…

I do have a obscure question…

are they all online when you run the tests?

my log shows CEF firing hundreds of calls in a large number of threads when my plugin ‘stalls’

john

I think so.

All the computers I tested were online, in the same network, with the same filter.

As mentioned in the first post SU 2016 works fine on this problem computer.