Skip to content

[IMP] Performances#126

Draft
brinkflew wants to merge 8 commits intobetafrom
avs-perfs
Draft

[IMP] Performances#126
brinkflew wants to merge 8 commits intobetafrom
avs-perfs

Conversation

@brinkflew
Copy link
Contributor

@brinkflew brinkflew commented Dec 23, 2025

Description

Improve performances of the framework.

Metrics below are gathered by running the same command 10 times and taking the average execution time, before and after changes.

Running odev version:

Check for updates less often, do not verify supporting database structure everytime, only install plugins requirements when installed or modified.

  before (ms) after (ms) gain (ms) gain (%)
Framework loaded 351 315 36 11,4%
Framework started 799 499 301 60,2%
Execution complete 869 590 279 47,4%

Running odev run <database> --st:

Prepare the virtual environments when creating a database only, not at every run.

  before (ms) after (ms) gain (ms) gain (%)
Execution complete 3703 2088 1615 77.4%

Running odev ls (3 databases):

Group ps aux and SQL queries. Do not display python version in virtual environment.

  before (ms) after (ms) gain (ms) gain (%)
Execution complete 1397 1012 385 38.0%

Compliance

  • I have read the contribution guide
  • I made sure the documentation is up-to-date both in doctrings and the docs directory
  • I have added or modified unit tests where necessary
  • I have added new libraries to the requirements.txt file, if any
  • I have incremented the version number according the versioning guide
  • The PR contains my changes only and no other external commit

@brinkflew brinkflew self-assigned this Dec 23, 2025
@brinkflew brinkflew added enhancement New feature or request framework Improvements or additions to the Odev framework labels Dec 23, 2025
@brinkflew brinkflew changed the title [IMP] Do not change database structure at every startup [IMP] Performances Dec 23, 2025
@brinkflew brinkflew force-pushed the avs-perfs branch 2 times, most recently from 63b61a9 to c949950 Compare December 24, 2025 10:00
Base automatically changed from beta to main January 28, 2026 18:44
Instead, only load table definitions and constraints when the table
is created. This only impacts Odev's database, used for internal
operations.

Performance gains:
- Framework loaded: 5ms (1.3%)
- Framework started: 48ms (6.4%)
- Execution completed: 46ms (5.5%)
Avoid some costly operations when update is not needed.

Performance gains:
- Framework loaded: 6ms (1.7%)
- Framework started: 48ms (5.8%)
- Execution completed: 51ms (6.5%)
Plugins where installed at every run of odev, taking a substantial
amount of time. Also check for missing requirements before running
`pip install`, as the operation is generally 50 times faster and can
prevent running a useless install.

Performance gains:
- Framework loaded: 25ms (8.1%)
- Framework started: 211ms (42.3%)
- Execution completed: 184ms (31.1%)
Move some imports to lazy-load features only when required.

Performance gains: minimal
We noticed the implematation of `functools.ttl_cache` was not fit with
our needs and was failing to cache some subprocesses results.
This had an unnecessary toll on performances when listing databases.
Allow choosing a value for the bypass (do or do not).
Only run the subprocess once for all databases instead of once per
database. This makes it more efficient if coupled with proper caching.
@brinkflew brinkflew changed the base branch from main to beta January 28, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request framework Improvements or additions to the Odev framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant