odoo/o-spreadsheet#7625

Created by fw-bot
Merged at 6cbf13e091b41bbccf3329fb38372c9075308eaf

Statuses:

label
odoo:saas-18.3-18.0-cached-add-dependencies-lul-483524-fw
head
79ca911bab7a866065da0e09f2d5b94c0b7bf53f
merged
2 days ago by BI, Lucas Lefèvre (lul)
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

Forward-Port-Of: #7622