Skip to content

Conversation

@LucasLefevre
Copy link
Collaborator

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

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
@robodoo
Copy link
Collaborator

robodoo commented Dec 10, 2025

Pull request status dashboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants