diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-08 14:07:59 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-08 14:15:12 +0300 |
commit | 73dc8c24e44ba8b462f88c1c629a84c98979ef41 (patch) | |
tree | 4b3cb93544a04a319ac79b8bf91e94cb76c201af /source/blender/python/intern/bpy_intern_string.c | |
parent | f76f48be23e04dbbbe313e428636cfcbcf2be59c (diff) |
PyAPI: optimize depsgraph use in PyDrivers
Avoid re-creating & freeing the depsgraph for every driver evaluation.
Now the depsgraph is kept in the name-space (matching self),
only re-created when the value changes.
In a contrived test-case with many drivers this gave ~15% overall
speedup for animation playback.
Diffstat (limited to 'source/blender/python/intern/bpy_intern_string.c')
-rw-r--r-- | source/blender/python/intern/bpy_intern_string.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c index 1cf8f3b65a0..817494cb70a 100644 --- a/source/blender/python/intern/bpy_intern_string.c +++ b/source/blender/python/intern/bpy_intern_string.c @@ -14,7 +14,7 @@ #include "BLI_utildefines.h" -static PyObject *bpy_intern_str_arr[16]; +static PyObject *bpy_intern_str_arr[17]; PyObject *bpy_intern_str___annotations__; PyObject *bpy_intern_str___doc__; @@ -31,6 +31,7 @@ PyObject *bpy_intern_str_frame; PyObject *bpy_intern_str_properties; PyObject *bpy_intern_str_register; PyObject *bpy_intern_str_self; +PyObject *bpy_intern_str_depsgraph; PyObject *bpy_intern_str_unregister; void bpy_intern_string_init(void) @@ -58,6 +59,7 @@ void bpy_intern_string_init(void) BPY_INTERN_STR(bpy_intern_str_properties, "properties"); BPY_INTERN_STR(bpy_intern_str_register, "register"); BPY_INTERN_STR(bpy_intern_str_self, "self"); + BPY_INTERN_STR(bpy_intern_str_depsgraph, "depsgraph"); BPY_INTERN_STR(bpy_intern_str_unregister, "unregister"); #undef BPY_INTERN_STR |