Skip to content

Master args at compile time lul laa#8804

Open
laa-odoo wants to merge 7 commits into
masterfrom
master-args-at-compile-time-lul-laa
Open

Master args at compile time lul laa#8804
laa-odoo wants to merge 7 commits into
masterfrom
master-args-at-compile-time-lul-laa

Conversation

@laa-odoo
Copy link
Copy Markdown
Collaborator

Task: 5905722

laa-odoo and others added 7 commits May 27, 2026 16:32
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
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: 5905722
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: 5905722
@robodoo
Copy link
Copy Markdown
Collaborator

robodoo commented May 28, 2026

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.

3 participants