Skip to content

Conversation

@bosd
Copy link
Contributor

@bosd bosd commented Aug 11, 2025

FW port of #424

Depends on #415

Creating a new snapshot has 2 main phases that we optimize in different ways:

  • duplicate previous snapshot
  • compute new stock parsing stock.move.line

duplicate previous snapshot

This can be at SQL level to avoid ORM overhead creating the request dynamically.

On my laptop duplicate 93633 previous stock.quant.history records goes from 5'21 to 0'09'' (x35 faster)

Compute new stock

This loop over stock.move.line between previous snapshot and the new one to compute new stock.quant.history. Looping over 2 read_group improve the situation in my current context processing 96462 stock.move.line from 1'37'' to 0'23''.

Creating a new snapshot has 2 main phases that we optimise in
different ways:

* duplicate previous snapshot
* compute new stock parsing stock.move.line

duplicate previous snapshot
---------------------------

This can be at SQL level to avoid ORM overhead creating the request
dynamically.

On my laptop duplicate 93633 previous stock.quant.history records
goes from 5'21 to 0'09'' (x35 faster)

Compute new stock
-----------------

This loop over stock.move.line between previous snapshot and the new
one to compute new stock.quant.history. Looping over 2 read_group
improve the situation in my current context processing 96462
stock.move.line from 1'37'' to 0'23''.
@OCA-git-bot
Copy link
Contributor

Hi @petrus-v,
some modules you are maintaining are being modified, check this out!

@bosd bosd marked this pull request as draft August 11, 2025 19:33
@bosd bosd changed the title stock_quant_history: performance improvements [17.0][IMP] stock_quant_history: performance improvements Aug 13, 2025
@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants