-
Notifications
You must be signed in to change notification settings - Fork 2
Speedup _add_meta(), _add_attachment() #539
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
Closed
Closed
Conversation
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
Contributor
Reviewer's GuideRefactors how meta and attachment dependencies are added by routing them, along with media entries, through a shared _add_rows() helper that builds and appends a typed DataFrame of new rows for performance and consistency. Class diagram for updated Dependencies row insertion helpersclassDiagram
class Dependencies {
DataFrame _df
_set_dtypes(df)
_add_attachment(file, archive, checksum, version)
_add_media(values)
_add_meta(file, checksum, version)
_add_rows(rows)
}
class DataFrame
class DefineModule {
DEPENDENCY_TABLE
DEPENDENCY_TYPE
}
Dependencies --> DataFrame : uses
Dependencies --> DefineModule : uses
class AddRowsTuple {
str file
str archive
int bit_depth
int channels
str checksum
float duration
str format
int removed
float sampling_rate
int type
str version
}
Dependencies ..> AddRowsTuple : constructs rows
Flow diagram for adding dependency rows via _add_rowsflowchart TD
A[_add_attachment] --> B[build single attachment tuple list]
A2[_add_meta] --> C[build single meta tuple list]
A3[_add_media] --> D[receive list of media tuples]
B --> E[_add_rows]
C --> E
D --> E
E --> F[build DataFrame from records
columns: file + DEPENDENCY_TABLE keys]
F --> G[set dtypes via _set_dtypes]
G --> H[concat new DataFrame to _df]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Member
Author
|
The current implementation does not really bring a boost, so we will close here. |
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.
Speedup
audb.Dependencies._add_meta()andaudb.Dependencies._add_attachment()by treating them in the same way asaudb.Dependencies._add_media().Currently, this fails as it would require that the meta or attachment to be added is not already stored in the dependency table. It seems our implementation makes use of the fact that we can overwrite the row for meta and attachment.
Summary by Sourcery
Unify how dependency rows are added for media, meta, and attachments by introducing a shared row insertion helper.
Enhancements: