taichi-dev/taichi

Get rid of @property when applicable

Open

#3.913 geöffnet am 30. Dez. 2021

Auf GitHub ansehen
 (2 Kommentare) (3 Reaktionen) (0 zugewiesene Personen)C++ (2.384 Forks)batch import
enhancementgood first issuepythonwelcome contribution

Repository-Metriken

Stars
 (28.195 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

As shown in https://github.com/taichi-dev/taichi/pull/3910, replacing property with simple attributes can speedup python part of taichi a lot. Lessons learned is that we should avoid using @property when applicable since it's expensive. So let's review the usage of @property in our python codebase and replace them as much as possible.

Here's a list of simple grep in our codebase showing filenames with @property:

 λ ~/github/taichi master rg "@property" python -l
python/taichi/_testing.py
python/taichi/lang/snode.py
python/taichi/lang/mesh.py
python/taichi/lang/impl.py
python/taichi/ui/gui.py
python/taichi/lang/any_array.py
python/taichi/lang/field.py
python/taichi/lang/ast/checkers.py
python/taichi/lang/_ndarray.py
python/taichi/lang/struct.py
python/taichi/snode/fields_builder.py
python/taichi/ui/window.py
python/taichi/snode/snode_tree.py
python/taichi/lang/matrix.py

Removing these should in general help speed up the python part of taichi programs.

Contributor Guide