odoo/o-spreadsheet#8806

Created by BI, Lucas Lefèvre (lul)

Blocked

label
odoo:master-args-at-compile-time-lul
head
f1b29a133219ae34937d198a78a614da2391e54f
odoo/o-spreadsheet
master #8806 missing r+

[PERF] evaluation: args definitions at compile time

Description:

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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 2841.65 ms, StdErr: 3.91 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 2678.65 ms, StdErr: 8.38 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 6470.76 ms, StdErr: 9.44 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 2703.84 ms, StdErr: 14.52 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 400.51 ms, StdErr: 2.94 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 3441.85 ms, StdErr: 14.57 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 491.04 ms, StdErr: 6.53 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 660.53 ms, StdErr: 3.85 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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
09ccc2440ef293e31c803f08a7d759060001b48d: Mean: 1423.05 ms, StdErr: 9.20 ms
c0ed960c129e064ca0b81537d45a818e6c379482: 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: TASK_ID

review checklist