taichi-dev/taichi

Get rid of @property when applicable

Open

#3 913 ouverte le 30 déc. 2021

Voir sur GitHub
 (2 commentaires) (3 réactions) (0 assignés)C++ (2 384 forks)batch import
enhancementgood first issuepythonwelcome contribution

Métriques du dépôt

Stars
 (28 195 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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.

Guide contributeur