GafferHQ / gaffer

Gaffer is a node-based application for lookdev, lighting and automation
http://www.gafferhq.org
BSD 3-Clause "New" or "Revised" License
953 stars 206 forks source link

slow auto-complete in Python Editor #5168

Open alex-savenko-at-cinesite opened 1 year ago

alex-savenko-at-cinesite commented 1 year ago

Version: Any e.g. 1.2.0.0

Description

Autocomplete in Python editor can get very slow if the object being completed has many slow dynamic properties. It seems that auto-completer evaluates every single property before it needs the result. Also, it evaluates all properties, even if they do not match the prefix.

Steps to reproduce

Here is a simple repro-case:

import time class Test(object): @property def slow(self): print("slow") time.sleep(1) t = Test() t.aa Now if you try auto-completing t.aaaa, you will notice the delay after every keypress and you will see "slow" being printed in the terminal even though "slow" does not match "aaaa" prefix.

Thanks you, Alex

johnhaddon commented 1 year ago

The other thing we could improve is to avoid building huge menus when there are a lot of matches.