odoo/o-spreadsheet#6827

Created by BI, Rémi Rahir (rar)

Blocked

label
odoo:18.0-imp-recompute-eval-rar
head
5426e101ddc37076a3845fa12900bde1c8599ff2
odoo/o-spreadsheet
18.0 #6827 missing r+
saas-18.1
saas-18.2
saas-18.3
saas-18.4
master

[FIX] Evaluation: Optimize invalidation of cell depending of spreads

Currently, we invalidate all the cells that depend on a spilling formula during its evaluation. However, some edgecases (like the one described below) can make the amount of dependant cells explode with a noticeable amount of redundancy in the cells invalidated.

study case:
- in A1 write =SPLIT("1 2", " ")
- in C1, write =B2
- autofill these over 1000 columns
- in another sheet, write a VLOOKUP that search in column C of sheet 1 and autofill around 7000 times

-> the evaluation becomes really slow

The example above is problematic because for each cell evaluated in A1-B1, we will the corresponding C formula along with EVERY cell with a VLOOKUP, which means the cells with VLOOKUP will be invalidated 500 (# or rows) times.
It so happens that the invalidation step requires to regroup all the cells in zones and this step can be costy, especially if repeated hundreds of times.

This revision captures the cells that need to be invalidated during a pass of evaluation and invalidates all of them at once to limit the overhead of regrouping them.

In the aforementioned example, the time to evaluate drops from 6.7 seconds to 2.1 seconds on average.

task-4954710

Description:

description of this task, what is implemented and why it is implemented that way.

Task: TASK_ID

review checklist

  • [ ] feature is organized in plugin, or UI components
  • [ ] support of duplicate sheet (deep copy)
  • [ ] in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • [ ] in model/UI: ranges are strings (to show the user)
  • [ ] undo-able commands (uses this.history.update)
  • [ ] multiuser-able commands (has inverse commands and transformations where needed)
  • [ ] new/updated/removed commands are documented
  • [ ] exportable in excel
  • [ ] translations (_t("qmsdf %s", abc))
  • [ ] unit tested
  • [ ] clean commented code
  • [ ] track breaking changes
  • [ ] doc is rebuild (npm run doc)
  • [ ] status is correct in Odoo