odoo/o-spreadsheet#7622

Created by BI, Lucas Lefèvre (lul)
Merged at 7c2da4957977ab0c3fdde2656b08d42e2de6511e

Statuses:

label
odoo:18.0-cached-add-dependencies-lul
head
939ed2611896bec7ce0d7805784618aabf588577
merged
8 hours ago by BI, Pierre Rousseau (pro)
odoo/o-spreadsheet
18.0 #7622
saas-18.2 #7624
saas-18.3 #7625
saas-18.4 #7626
19.0 #7627
master #7628

[PERF] evaluation: cached dynamic dependencies

Steps to reproduce:
- create a (large) pivot from a range
- convert it to individual formulas

=> for each formula, the formula dynamically adds (at evaluation time) its dependency on the underlying pivot range.

The evaluation engine ensures this dependency has already been evaluated.

Before this commit, we were checking every single position one by one, for every pivot formula. Even if computeAndSave was doing nothing because it was already computed, the code still iterated over the entire range.

With this commit, we rely on the range function from the compilation parameters, which is a built-in cache of ranges that were previously evaluated.

With the large demo pivot data set:

  • grouped by "Month & Year" (8*183=1464 formulas)

before: ~3750ms
after: ~787ms

  • grouped by "Day" (8*4616=36928 formulas)

before: ~79500ms
after: ~4612ms

task-5407156

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