From 8f1f32d0fbb62f6cfac1a80c272e73831e00a9e3 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Thu, 11 Jan 2024 14:36:50 +0100 Subject: [PATCH] [FIX] web: improve ListRenderer rendering speed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ListRenderer disables the checkbox of all lines corresponding to a record which cannot be selected. Unfortunately, because `canSelectRecord` is a getter, it is invoked once per line, and this getter in turns invokes the `editedRecord` getter which scans all record to find which record is selected. This operation is O(n²), so it's very slow when there are a lot of records. This commit fixes that by computing the value once per render. Time to render the list view of views (technical > User Interface > views) with 600 records visible: - before: ~1800ms - after: ~250ms closes odoo/odoo#149051 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/views/list/list_renderer.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/views/list/list_renderer.xml b/addons/web/static/src/views/list/list_renderer.xml index caff9c8511e..922ff52006f 100644 --- a/addons/web/static/src/views/list/list_renderer.xml +++ b/addons/web/static/src/views/list/list_renderer.xml @@ -2,6 +2,7 @@ +
- + - +