taichi-dev/taichi

Get rid of @property when applicable

Open

#3,913 创建于 2021年12月30日

在 GitHub 查看
 (2 评论) (3 反应) (0 负责人)C++ (2,384 fork)batch import
enhancementgood first issuepythonwelcome contribution

仓库指标

Star
 (28,195 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南