Copy tool from pyRevit running slow

Hi all,

When I test the tool in pyRevit, for example, Sheets ā†’ Select Sheets. Running in the pyRevit tab takes <1 second.
image

But if I create a custom extension, and copy the button Select Sheets, it takes 3-4 seconds to run.
image

More detail: Select sheets source code is using the pyrevit lib.

"""Select multiple sheets from a list"""
#pylint: disable=import-error,invalid-name
from pyrevit import revit
from pyrevit import forms

selection = revit.get_selection()
sel_sheets = forms.select_sheets(title='Select Sheets')

if sel_sheets:
    selection.set_to(sel_sheets)

Could you please explain why pyrevit lib works so fast in pyRevit tab but the others tab is slow?

Thank you
Tien

It might be a Cache thing.
If you run the function again, I am pretty sure it runs faster/at normal speed

Hi Jean,

Thanks for your reply.

But I ran many times and had the same issue. :frowning:

You can check the video attached to see the behavior

https://drive.google.com/file/d/1dL0oSiafjglPN8Rpu-d8U5-VIY53E5D1/view?usp=sharing

1 Like

just found some interesting problem

Iā€™m watching the Task Manager while running the pyRevit tool and the tool in the custom extension.

pyRevit tool only costs about 3 MB to run, but the tool in the custom extension costs about 30 MB.
And the memory is never released after finishing the tool.

As you can see I opened the same project, and the memory is bigger after running time (just click on the tool and hit Esc). the more click on the tools, the more memory cost.