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

perf(breadbox): Small breadbox performance tweak #214

Merged
merged 3 commits into from
Mar 10, 2025

Conversation

snwessel
Copy link
Member

@snwessel snwessel commented Mar 10, 2025

This may no longer be relevant, since it sounds like Randy found a different solution that doesn't use this parameter - but I wanted to commit my changes anyway since they improve performance a bit (and this endpoint may be used again in the future).

Background: Randy noticed that this endpoint takes a long time when ?show_only_dimensions_in_datasets=true is set (for example, here)

Solution: moving a couple of things into the SQLAlchemy query, so that only distinct given IDs are loaded into memory (instead of the full Dimension objects)

This makes the endpoint (with the show_only_dimensions_in_datasets parameter) about 4x faster with my somewhat-realistic local data.

@snwessel snwessel requested a review from jessica-cheng March 10, 2025 15:54
@snwessel snwessel changed the title breadbox(perf): Small breadbox performance tweak perf(breadbox): Small breadbox performance tweak Mar 10, 2025
Copy link
Contributor

@jessica-cheng jessica-cheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -783,19 +784,21 @@ def get_unique_dimension_ids_from_datasets(
unique_dims = set()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we can remove this with your changes!


for t_dim in tabular_dimension_ids:
unique_dims.add(t_dim.dimension_given_id)
unique_dims = tabular_dimension_ids.union(matrix_dimension_ids)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@snwessel snwessel merged commit c5debd8 into master Mar 10, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants