Commit 90a817d
committed
[PERF] evaluation: zonify evaluation
This commit improves evaluation time from 5% to 20% on regular spreadsheet,
depending on the spreadsheet. And even from 99% on some pathological cases
Benchmark: https://www.odoo.com/odoo/documents/d9dGIrjZRTSa9nf153wEIwo9e4c5
Let’s say you have two formulas that depend on the same reference:
A1: =C1
A2: =C1
In the FormulaDependencyGraph, both dependencies are added independently.
Specifically, the R-tree data structure ends up with two separate entries:
C1 -> A1 and C1 -> A2.
Ideally, the internal R-tree structure should group these dependencies into a
single node in the tree:
C1 -> [A1, A2] or even C1 -> [A1:A2] because they can be grouped into a single
zone.
When this pattern occurs frequently, the R-tree becomes huged (and unbalanced)
therefore sub-optimal.
- Huge: lots and lots of individual positions
- Unbalanced: this is common when using individual pivot formulas
(e.g., for spreadsheet pivots), where each PIVOT.VALUE formula depends on the
same range—the pivot dataset.
With this commit, the dependencies R-Tree maps bounding boxes to zones, instead
of bounding boxes to positions.
To take advantage of this grouping, the entire evaluation process now uses
zones as much as possible.
closes #7360
Task: 4936229
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>1 parent a7242a9 commit 90a817d
File tree
15 files changed
+910
-155
lines changed- demo
- packages/o-spreadsheet-engine/src
- helpers
- plugins/ui_core_views/cell_evaluation
- types
- tests
- helpers
- test_helpers
15 files changed
+910
-155
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3936 | 3936 | | |
3937 | 3937 | | |
3938 | 3938 | | |
3939 | | - | |
3940 | | - | |
3941 | | - | |
3942 | | - | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
3943 | 3943 | | |
3944 | | - | |
| 3944 | + | |
3945 | 3945 | | |
3946 | 3946 | | |
3947 | | - | |
| 3947 | + | |
| 3948 | + | |
3948 | 3949 | | |
3949 | 3950 | | |
3950 | 3951 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
231 | 236 | | |
232 | 237 | | |
233 | 238 | | |
| |||
Lines changed: 44 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
182 | 210 | | |
183 | 211 | | |
184 | 212 | | |
| |||
277 | 305 | | |
278 | 306 | | |
279 | 307 | | |
280 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
281 | 319 | | |
282 | 320 | | |
283 | 321 | | |
| |||
301 | 339 | | |
302 | 340 | | |
303 | 341 | | |
304 | | - | |
| 342 | + | |
305 | 343 | | |
306 | 344 | | |
307 | 345 | | |
| |||
333 | 371 | | |
334 | 372 | | |
335 | 373 | | |
336 | | - | |
337 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
338 | 378 | | |
339 | 379 | | |
340 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | 505 | | |
520 | 506 | | |
521 | 507 | | |
| |||
Lines changed: 141 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
0 commit comments