taichi-dev/taichi

Get rid of @property when applicable

Open

#3,913 opened on Dec 30, 2021

View on GitHub
 (2 comments) (3 reactions) (0 assignees)C++ (28,195 stars) (2,384 forks)batch import
enhancementgood first issuepythonwelcome contribution

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.

Contributor guide