Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cache git logs to accelerate displaying the versions of a node in oxidized-web #3384

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robertcheramy
Copy link
Collaborator

Pre-Request Checklist

  • Passes rubocop code analysis (try rubocop --auto-correct)
  • Tests added or adapted (try rake test)
  • Changes are reflected in the documentation
  • User-visible changes appended to CHANGELOG.md

Description

In order to address the performance issues observed in oxidzed-web when listing the versions of a node, this PR caches git log into memory. At the first time, we still have a slow performance, subsequent calls only need to scan new commits and are very much faster.

Closes issue #3121

@robertcheramy robertcheramy requested a review from ytti February 2, 2025 18:44
if @gitcache[repo_path][:nodes][filename]
# using the splat operator (*) should be OK as hashlist should
# not be very big when working on deltas
@gitcache[repo_path][:nodes][filename].prepend(*hashlist)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ytti - do you have experience or an opinion on using the splat operator for prepending an array to an array?
There are alternatives to the splat operator, but I found this to be the most readable and efficient.
I read that when the array is smaller than 1000 entries, the splat operator is not a problem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant