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

Improve fetch_for_repository performance #28

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

jacobobq
Copy link
Contributor

@jacobobq jacobobq commented Dec 5, 2024

Calling Resource#repository produces a call to safe_constantize on the repository_raw string. Such calls are expensive because they trigger a loading cascade of other constants. In this case, it's also unnecessary since you can find repositories by comparing the strings directly, so we bypass the need for it completely.

We've also made the method more scalable for successive calls by creating an appropriate hash index for direct repository_raw lookups.

Captura de pantalla 2024-12-05 a las 12 16 08

@jacobobq jacobobq self-assigned this Dec 5, 2024
@jacobobq jacobobq changed the title fix: improve fetch_for_repository performance Improve fetch_for_repository performance Dec 5, 2024
@jacobobq jacobobq requested a review from gtrias December 5, 2024 11:16
Copy link
Member

@gtrias gtrias left a comment

Choose a reason for hiding this comment

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

Amazing!

@jacobobq jacobobq merged commit 4cf562a into main Dec 5, 2024
1 check 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