Improve GUI startup time#962
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve GUI startup time by deferring heavyweight imports until they’re actually needed during user interactions, reducing initial module import cost when launching the GUI.
Changes:
- Lazy-load
birdnet_analyzer.audioin the single-file GUI tab only when audio operations are triggered. - In the evaluation GUI tab, defer imports of
matplotlib,process_data, andDataProcessoruntil the related actions run. - Add
from __future__ import annotationsandTYPE_CHECKING-guarded imports to keep runtime imports light while preserving type hints.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
birdnet_analyzer/gui/single_file.py |
Removes eager audio import and performs local imports in the two callbacks that actually read audio data. |
birdnet_analyzer/gui/evaluation.py |
Defers heavier evaluation/plotting imports to action handlers; uses postponed annotations + TYPE_CHECKING to avoid runtime type-import costs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Just small improvements sadly nothing major