[FIX] web: fix performance issues with large x2m fields
Previously, when a view contained an x2m field that had a few thousand
records, the view would take ages to load. This was caused by a few
things in the basic model where we would linearly scan lists of records
in a tight loop, and doing so for every single other record, causing
quadratic increase runtime with regards to the number of records. For
example, creating a new batch picking in stock with 4000 existing
pickings would take up to ~20 seconds to load the view.
This commit creates a few objects to use as lookup tables in such
places, which speeds up the loading of the view to less than a second.
It also makes the context of the DataPoint into a property that's
initialized lazily on first read, as creating a context and the
corresponding evalContext can be expensive, which becomes a problem when
creating thousands of DataPoints whose context will never be read.
opw-3465073
closes odoo/odoo#135860
Signed-off-by:
Aaron Bohy (aab) <aab@odoo.com>
Loading
Please register or sign in to comment