Skip to content

Master faster visit matching ranges lul#8911

Open
LucasLefevre wants to merge 2 commits into
masterfrom
master-faster-visitMatchingRanges-lul
Open

Master faster visit matching ranges lul#8911
LucasLefevre wants to merge 2 commits into
masterfrom
master-faster-visitMatchingRanges-lul

Conversation

@LucasLefevre

@LucasLefevre LucasLefevre commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description:

Bunch tool

cells imported in
  6ed4851d7:  Mean: 2650.00 ms, StdErr: 6.15 ms
  1e2fdf985:  Mean: 2643.66 ms, StdErr: 5.65 ms → ⚫ (vs prev: -0%, Δ=-6.34 ms, combined StdErr=8.35 ms, |Δ|/SE=-0.8x; n=20)
  0ac99c06d:  Mean: 2647.70 ms, StdErr: 4.96 ms → ⚫ (vs prev: +0%, vs baseline: -0%, Δ=+4.03 ms, combined StdErr=7.52 ms, |Δ|/SE=0.5x; n=20)

evaluate all cells
  6ed4851d7:  Mean: 2381.09 ms, StdErr: 9.10 ms
  1e2fdf985:  Mean: 2025.87 ms, StdErr: 7.22 ms → 🟢 (vs prev: -15%, Δ=-355.23 ms, combined StdErr=11.61 ms, |Δ|/SE=-30.6x; n=20)
  0ac99c06d:  Mean: 1902.54 ms, StdErr: 5.89 ms → 🟢 (vs prev: -6%, vs baseline: -20%, Δ=-123.33 ms, combined StdErr=9.32 ms, |Δ|/SE=-13.2x; n=20)

Model created in
  6ed4851d7:  Mean: 5886.37 ms, StdErr: 10.83 ms
  1e2fdf985:  Mean: 5519.48 ms, StdErr: 8.33 ms  → 🟢 (vs prev: -6%, Δ=-366.89 ms, combined StdErr=13.66 ms, |Δ|/SE=-26.9x; n=20)
  0ac99c06d:  Mean: 5398.08 ms, StdErr: 7.92 ms  → 🟢 (vs prev: -2%, vs baseline: -8%, Δ=-121.40 ms, combined StdErr=11.49 ms, |Δ|/SE=-10.6x; n=20)


Legend:
  ⚫: no measurable change |Δ|/SE < 2
  🔴: slower Δ > 0 and |Δ|/SE >= 2
  🟢: faster Δ < 0 and |Δ|/SE >= 2

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

Improve all functions using visitMatchingRanges:
COUNTIF(S), SUMIF(S), COUNTUNIQUEIFS, AVERAGEIF(S), MAXIF(S), MINIF(S)

The common case isn't wildcard comparisons. Yet, a regexp check is not cheap.

With this commit, we optimize the common case which doesn't use wildcard
by skipping regexp matching.

Bunch tool
----------

cells imported in
  6ed4851:  Mean: 2684.08 ms, StdErr: 15.90 ms
  9ab3d8ef2:  Mean: 2689.98 ms, StdErr: 27.34 ms → ⚫ (vs prev: +0%, Δ=+5.90 ms, combined StdErr=31.63 ms, |Δ|/SE=0.2x; n=20)

evaluate all cells
  6ed4851:  Mean: 2460.76 ms, StdErr: 31.45 ms
  9ab3d8ef2:  Mean: 2054.28 ms, StdErr: 17.58 ms → 🟢 (vs prev: -17%, Δ=-406.47 ms, combined StdErr=36.02 ms, |Δ|/SE=-11.3x; n=20)

START
  6ed4851:  Mean: 3175.20 ms, StdErr: 40.12 ms
  9ab3d8ef2:  Mean: 2767.07 ms, StdErr: 22.78 ms → 🟢 (vs prev: -13%, Δ=-408.13 ms, combined StdErr=46.13 ms, |Δ|/SE=-8.8x; n=20)

Model created in
  6ed4851:  Mean: 6017.55 ms, StdErr: 55.30 ms
  9ab3d8ef2:  Mean: 5617.84 ms, StdErr: 49.23 ms → 🟢 (vs prev: -7%, Δ=-399.71 ms, combined StdErr=74.04 ms, |Δ|/SE=-5.4x; n=20)

Global
  6ed4851:  Mean: 6017.84 ms, StdErr: 55.30 ms
  9ab3d8ef2:  Mean: 5618.14 ms, StdErr: 49.23 ms → 🟢 (vs prev: -7%, Δ=-399.70 ms, combined StdErr=74.04 ms, |Δ|/SE=-5.4x; n=20)

Legend:
  ⚫: no measurable change |Δ|/SE < 2
  🔴: slower Δ > 0 and |Δ|/SE >= 2
  🟢: faster Δ < 0 and |Δ|/SE >= 2
The operand is processed over and over again when evaluating the predicate
for each element of the range, which could be huge.

With this commit, we "pre-compile" the predicate once into a closure, then
use the closure for each element.

cells imported in
  097548002:  Mean: 2644.16 ms, StdErr: 12.60 ms
  5ccb69f49:  Mean: 2646.22 ms, StdErr: 8.92 ms  → ⚫ (vs prev: +0%, Δ=+2.06 ms, combined StdErr=15.44 ms, |Δ|/SE=0.1x; n=4)

evaluate all cells
  097548002:  Mean: 2014.48 ms, StdErr: 7.52 ms
  5ccb69f49:  Mean: 1910.35 ms, StdErr: 16.59 ms → 🟢 (vs prev: -5%, Δ=-104.13 ms, combined StdErr=18.22 ms, |Δ|/SE=-5.7x; n=4)

START
  097548002:  Mean: 2699.31 ms, StdErr: 8.32 ms
  5ccb69f49:  Mean: 2602.79 ms, StdErr: 17.18 ms → 🟢 (vs prev: -4%, Δ=-96.51 ms, combined StdErr=19.09 ms, |Δ|/SE=-5.1x; n=4)

Model created in
  097548002:  Mean: 5500.24 ms, StdErr: 12.36 ms
  5ccb69f49:  Mean: 5401.26 ms, StdErr: 20.85 ms → 🟢 (vs prev: -2%, Δ=-98.99 ms, combined StdErr=24.24 ms, |Δ|/SE=-4.1x; n=4)

Global
  097548002:  Mean: 5500.54 ms, StdErr: 12.36 ms
  5ccb69f49:  Mean: 5401.55 ms, StdErr: 20.85 ms → 🟢 (vs prev: -2%, Δ=-98.99 ms, combined StdErr=24.24 ms, |Δ|/SE=-4.1x; n=4)

Legend:
  ⚫: no measurable change |Δ|/SE < 2
  🔴: slower Δ > 0 and |Δ|/SE >= 2
  🟢: faster Δ < 0 and |Δ|/SE >= 2
@robodoo

robodoo commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

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