diff options
| author | Adrian Torres <adt@odoo.com> | 2020-01-03 08:12:03 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-01-21 08:28:36 +0000 |
| commit | be01db2f712952a6c1d3688c8587d9624ef5dcc5 (patch) | |
| tree | a152b7fbb78b6367dd129b72b3fe08bc1632169c /addons/project/views/project_views.xml | |
| parent | 8645e31863fa76a737ce5cf79a41c95ce7853507 (diff) | |
[IMP] api: move cache_key to the Environment and cache it
Computing the `cache_key` turned out to be a big factor during the
lifespan of a `BaseModel.mapped` call and a lot of this time is spent
computing the same `cache_key` over and over.
These unnecessary computations can be easily reduced to a couple by
moving the `cache_key` method on the environment (instead of the field)
and by implementing a memo for that method. The rationale is that the
`cache_key` of a field does not change for a given environment.
The result of this patch is up to 50% faster `Field.__get__` which in
turn means a GLOBAL gain in performance, especially for methods /
functions that rely heavily on `__get__` such as `BaseModel.mapped`.
closes odoo/odoo#42674
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
Diffstat (limited to 'addons/project/views/project_views.xml')
0 files changed, 0 insertions, 0 deletions
