-
Notifications
You must be signed in to change notification settings - Fork 66
[PERF] evaluation: zonify dependencies #7193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5e04745
to
2f1fcaf
Compare
7f3c8c5
to
33e3fdc
Compare
const rTreeItems: RTreeItem<BoundedRange>[] = []; | ||
for (const sheetId of this.getters.getSheetIds()) { | ||
const cells = this.getters.getCells(sheetId); | ||
for (const cellId in cells) { | ||
const cell = cells[cellId]; | ||
if (cell.isFormula) { | ||
const directDependencies = cell.compiledFormula.dependencies; | ||
for (const range of directDependencies) { | ||
if (range.invalidSheetName || range.invalidXc) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot more dégueulasse, but with way less array allocations
aac79fd
to
deb728a
Compare
a559079
to
7b26fbd
Compare
|
||
insert(item: RTreeRangeItem) { | ||
const data = this.rTree.search(item.boundingBox); | ||
const exactBoundingBox = data.find((d) => deepEquals(d.boundingBox, item.boundingBox)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe replace all deepEquals with a straight comparison since we know the structure of a boundingbox ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems worth it
https://jsperf.app/pifawe
6421c4d
to
ebe5285
Compare
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. Task: 4936229
ebe5285
to
c1b1527
Compare
backported in 19.0 #7358 |
Description:
performance measures: https://www.odoo.com/odoo/documents/d9dGIrjZRTSa9nf153wEIwo9e4c5
Task: 4936229
review checklist