Don't use progress dialog with large data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I already faced this issue with other languages so I don't call this a bug. I just want to warn people about this behavior.
Here is a code that runs two empty loops:
#Author- #Description- import adsk.core, adsk.fusion, adsk.cam, traceback import time def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface elapsedTime = [0.0, 0.0] N = 25000 progressDialog = ui.createProgressDialog() progressDialog.cancelButtonText = 'Cancel' progressDialog.isBackgroundTranslucent = False progressDialog.isCancelButtonShown = True progressDialog.hide() progressDialog.show('Speed test', 'Percentage: %p, Current Value: %v, Total steps: %m', 0, N) startTime = time.time() for i in range(0, N): if progressDialog.wasCancelled: break progressDialog.progressValue = i pass elapsedTime[0] = time.time() - startTime progressDialog.hide() startTime = time.time() for i in range(0, N): pass elapsedTime[1] = time.time() - startTime ui.messageBox('{:.1f} s\n{:.1f} s'.format(elapsedTime[0], elapsedTime[1])) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Now the results on my PC (i7-3700) for 25000 iterations:
- First loop with the progress dialog: 13.2s
- Second loop without the progress dialog: 0.0s
It's even worst on my Mac (i5-3210M):
- First loop with the progress dialog: 208s
- Second loop without the progress dialog: 0.0s
More results from a code in which I export mesh data to STL file with and without the progress dialog.
On my PC:
- Low mesh refinement (3900 iterations): 2.0s / 0.0s
- Normal mesh refinement (9000 iterations): 4.6s / 0.1s
- High mesh refinement (26000 iterations): 13.1s / 0.3s
- Very High mesh refinement (89600 iterations): 45.6s / 0.9s
Same results on my Mac:
- Low mesh refinement (3900 iterations): 32s / 0.0s
- Normal mesh refinement (9000 iterations): 75s / 0.1s
- High mesh refinement (26000 iterations): 216s / 0.2s
- Very High mesh refinement (89600 iterations): 745 / 0.8s
The progress dialog costs 0.0005 second per iteration on my PC and 0.008 second per iteration on my Mac.
Now you know!
Jérôme Briot, Freelance engineer - Mechanical design and prototyping
3D Print Plus / Pro | IDF Import | GitHub To Fusion 360 | Tube Bending Data Exchanger | Slice Data Export
Memory Used | Basic Calculator | Check Computer Specifications | Import spline from any CSV file