Skip to content
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

[FW][PERF] evaluation: faster dependencies checking #4125

Closed

Conversation

fw-bot
Copy link
Collaborator

@fw-bot fw-bot commented Apr 24, 2024

On RNG's spreadsheet, from 12+ secondes to <180ms

Task: 3874821

Description:

description of this task, what is implemented and why it is implemented that way.

Task: : TASK_ID

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

Forward-Port-Of: #4118
Forward-Port-Of: #4093

@robodoo
Copy link
Collaborator

robodoo commented Apr 24, 2024

@fw-bot
Copy link
Collaborator Author

fw-bot commented Apr 24, 2024

@LucasLefevre @rrahir cherrypicking of pull request #4093 failed.

stdout:

Auto-merging src/helpers/misc.ts
Auto-merging src/helpers/recompute_zones.ts
CONFLICT (add/add): Merge conflict in src/helpers/recompute_zones.ts

stderr:

13:26:09.464480 git.c:463               trace: built-in: git cherry-pick c730865c9cee2a1a11617c0df21a395e958aa19e
error: could not apply c730865c9... [IMP] helpers: backport recompute zone
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
----------
status:

Either perform the forward-port manually (and push to this branch, proceeding as usual) or close this PR (maybe?).

In the former case, you may want to edit this PR message as well.

⚠️ after resolving this conflict, you will need to merge it via @robodoo.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@rrahir rrahir force-pushed the master-saas-16.4-faster-dependencies-lul-Cp2o-fw branch from cd415a4 to e3d6e52 Compare April 24, 2024 13:03
Adrien Minne (adrm) and others added 2 commits April 24, 2024 15:03
The recent refactoring of `recomputeZone` was typed such that it could
only handle unbounded zones.
This commit improves the performance of a pathological case of the
dependency finding algorithm.

Let's say
All cells in column B depends on A1 (each cell in B contains a
formula referencing A1).
All cells in column C depends on every cell in B

What happens when we update A1: the first `while` iteration finds all cells in
B, which are pushed in the process queue (B1, B2, B3, B4, ...).
At the next iteration, the code searches for the dependencies of B1 and adds them
to the queue (now B2, B3, B4, ..., C1, C2, C3, ...)
The next iteration, we search for the dependencies of B2 which are again
C1, C2, C3,... They are not pushed to the queue because we already visited
them, but we still have to process them.
Next is the dependencies of B3...again C1, C2, C3, ...

We process over and over again the same positions.

With this commit, we no longer process individual positions one after the other.
We first group positions in bigger zones. With the example above, we would
have grouped B1, B2, B3, ... into a single zone with the the entire B column.
Hence we do a single `this.rTree.search` rather one per position.

On RNG's spreadsheet, `getCellsDependingOn` total time goes from 12+ secondes
to <180ms, (~90% to ~10%) when updating certain cells with the describe
dependency configuration.

Task: 3874821
@rrahir rrahir force-pushed the master-saas-16.4-faster-dependencies-lul-Cp2o-fw branch from e3d6e52 to 4552587 Compare April 24, 2024 13:06
@rrahir
Copy link
Collaborator

rrahir commented Apr 24, 2024

@robodoo r+

@rrahir
Copy link
Collaborator

rrahir commented Apr 24, 2024

@robodoo rebase-ff

@robodoo
Copy link
Collaborator

robodoo commented Apr 24, 2024

Merge method set to rebase and fast-forward.

robodoo pushed a commit that referenced this pull request Apr 24, 2024
The recent refactoring of `recomputeZone` was typed such that it could
only handle unbounded zones.

Part-of: #4125
robodoo pushed a commit that referenced this pull request Apr 24, 2024
This commit improves the performance of a pathological case of the
dependency finding algorithm.

Let's say
All cells in column B depends on A1 (each cell in B contains a
formula referencing A1).
All cells in column C depends on every cell in B

What happens when we update A1: the first `while` iteration finds all cells in
B, which are pushed in the process queue (B1, B2, B3, B4, ...).
At the next iteration, the code searches for the dependencies of B1 and adds them
to the queue (now B2, B3, B4, ..., C1, C2, C3, ...)
The next iteration, we search for the dependencies of B2 which are again
C1, C2, C3,... They are not pushed to the queue because we already visited
them, but we still have to process them.
Next is the dependencies of B3...again C1, C2, C3, ...

We process over and over again the same positions.

With this commit, we no longer process individual positions one after the other.
We first group positions in bigger zones. With the example above, we would
have grouped B1, B2, B3, ... into a single zone with the the entire B column.
Hence we do a single `this.rTree.search` rather one per position.

On RNG's spreadsheet, `getCellsDependingOn` total time goes from 12+ secondes
to <180ms, (~90% to ~10%) when updating certain cells with the describe
dependency configuration.

closes #4125

Task: 3874821
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
@robodoo robodoo closed this Apr 24, 2024
@robodoo robodoo added the 17.3 label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants