Skip to content
Snippets Groups Projects
Commit f5684138 authored by Samuel Degueldre's avatar Samuel Degueldre
Browse files

[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: default avatarAaron Bohy (aab) <aab@odoo.com>
parent f115ecfd
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment