Skip to content

[REF] compiler: introduce technic part for lazy evaluation#8895

Open
laa-odoo wants to merge 12 commits into
master-args-at-compile-time-lulfrom
master-lazy-evaluation-on-array-formula-laa
Open

[REF] compiler: introduce technic part for lazy evaluation#8895
laa-odoo wants to merge 12 commits into
master-args-at-compile-time-lulfrom
master-lazy-evaluation-on-array-formula-laa

Conversation

@laa-odoo

Copy link
Copy Markdown
Collaborator
  • Introduce lazy evaluation for simple arg
  • Introduce lazy evaluation for arg working with partial array

Task: 6296812

laa-odoo and others added 7 commits June 9, 2026 10:24
A number of checks and pre/post processing is done for each executed
function.
Some of it can be known at compile time since it only depends on the
function and the number of arguments.

With this commit, we pre-compute a number of things only once at compile
time to minimize what is done when executing the function.

Bunch report
------------

cells imported in
  09ccc24:  Mean: 2841.65 ms, StdErr: 3.91 ms
  c0ed960:  Mean: 2758.60 ms, StdErr: 6.32 ms → 🟢 (vs prev: -3%, Δ=-83.05 ms, combined StdErr=7.43 ms, |Δ|/SE=-11.2x; n=20)

evaluate all cells
  09ccc24:  Mean: 2678.65 ms, StdErr: 8.38 ms
  c0ed960:  Mean: 2458.64 ms, StdErr: 11.72 ms → 🟢 (vs prev: -8%, Δ=-220.02 ms, combined StdErr=14.41 ms, |Δ|/SE=-15.3x; n=20)

Model created in
  09ccc24:  Mean: 6470.76 ms, StdErr: 9.44 ms
  c0ed960:  Mean: 6158.89 ms, StdErr: 14.90 ms → 🟢 (vs prev: -5%, Δ=-311.87 ms, combined StdErr=17.64 ms, |Δ|/SE=-17.7x; n=20)

Large formula dataset
---------------------

cells imported in
  09ccc24:  Mean: 2703.84 ms, StdErr: 14.52 ms
  c0ed960:  Mean: 2704.29 ms, StdErr: 14.18 ms → ⚫ (vs prev: +0%, Δ=+0.45 ms, combined StdErr=20.30 ms, |Δ|/SE=0.0x; n=20)

evaluate all cells
  09ccc24:  Mean: 400.51 ms, StdErr: 2.94 ms
  c0ed960:  Mean: 375.49 ms, StdErr: 2.43 ms → 🟢 (vs prev: -6%, Δ=-25.02 ms, combined StdErr=3.81 ms, |Δ|/SE=-6.6x; n=20)

Model created in
  09ccc24:  Mean: 3441.85 ms, StdErr: 14.57 ms
  c0ed960:  Mean: 3419.21 ms, StdErr: 14.61 ms → ⚫ (vs prev: -1%, Δ=-22.64 ms, combined StdErr=20.63 ms, |Δ|/SE=-1.1x; n=20)

Other production spreadsheet (heavily vectorized)
-------------------------------------------------

⚫ no measureable change anywhere

Yet another production spreadsheet (with some vectorization)
------------------------------------------------------------

cells imported in
  09ccc24:  Mean: 491.04 ms, StdErr: 6.53 ms
  c0ed960:  Mean: 493.73 ms, StdErr: 4.17 ms → ⚫ (vs prev: +1%, Δ=+2.69 ms, combined StdErr=7.75 ms, |Δ|/SE=0.3x; n=20)

evaluate all cells
  09ccc24:  Mean: 660.53 ms, StdErr: 3.85 ms
  c0ed960:  Mean: 633.88 ms, StdErr: 3.46 ms → 🟢 (vs prev: -4%, Δ=-26.65 ms, combined StdErr=5.18 ms, |Δ|/SE=-5.1x; n=20)

Model created in
  09ccc24:  Mean: 1423.05 ms, StdErr: 9.20 ms
  c0ed960:  Mean: 1396.71 ms, StdErr: 7.02 ms → 🟢 (vs prev: -2%, Δ=-26.33 ms, combined StdErr=11.57 ms, |Δ|/SE=-2.3x; n=20)

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

Task: 6254300
Remove the layer that was adapting the return value
of the compute formula by directly creating the values
object within each compute function definition.

This simplifies typing by reducing the number of
different return cases that needed to be handled in
the compute functions.

Task: 6254300
Introduce a type-level distinction between formulas that
return a scalar value and formulas that return an array.
Previously, all formulas shared the same return type
signature, making it impossible to enforce correct
usage at compile time.

This distinction will help in future commits to know,
at compile time, what can be vectorized and what cannot.

Task: 6254300
It is no longer necessary to check at each compute function
whether vectorization is required.
Now, the compilation tells us whether a formula needs to be
vectorized or not.

Task: 6254300
…ized args

Instead of storing a boolean array where each index indicates whether
an argument should be vectorized, store only the indices of arguments
that need vectorization. This avoids iterating over all arguments and
directly targets only the relevant ones.

Task: 6254300
- Introduce lazy evaluation for simple arg
- Introduce lazy evaluation for arg working with partial array

task: 5905722
@robodoo

robodoo commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

This PR targets the un-managed branch odoo/o-spreadsheet:master-args-at-compile-time-lul, it needs to be retargeted before it can be merged.

@laa-odoo laa-odoo force-pushed the master-lazy-evaluation-on-array-formula-laa branch from 0bfddb0 to 31b807b Compare June 25, 2026 13:01
@laa-odoo laa-odoo force-pushed the master-args-at-compile-time-lul branch 3 times, most recently from b88b55c to 067cf3d Compare June 26, 2026 08:48
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.

3 participants