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

fix: Improve performance of get_revision_name() #317

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

matheus23
Copy link
Member

This simply caches the result of get_revision_name(), as that's accessed quite a lot and would otherwise cause lots of repeated BigUint operations, which are costly.

It improves performance of general filesystem operations by roughly 20% in my limited testing (I compared runtime of cargo test --lib -p wnfs -- "private::directory::").

@matheus23 matheus23 self-assigned this Jul 25, 2023
@matheus23 matheus23 requested a review from a team as a code owner July 25, 2023 09:06
@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #317 (170d0ee) into main (e998628) will increase coverage by 0.09%.
The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #317      +/-   ##
==========================================
+ Coverage   56.25%   56.34%   +0.09%     
==========================================
  Files          43       43              
  Lines        3198     3207       +9     
  Branches      774      775       +1     
==========================================
+ Hits         1799     1807       +8     
  Misses        903      903              
- Partials      496      497       +1     
Files Changed Coverage Δ
wnfs/src/private/node/header.rs 80.82% <93.33%> (+1.13%) ⬆️
wnfs/src/private/directory.rs 67.78% <100.00%> (ø)
wnfs/src/private/file.rs 78.37% <100.00%> (ø)
wnfs/src/private/node/node.rs 70.11% <100.00%> (ø)
wnfs/src/private/previous.rs 70.78% <100.00%> (ø)

Copy link
Member

@appcypher appcypher left a comment

Choose a reason for hiding this comment

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

LGMT! 🎉

@matheus23 matheus23 merged commit 55cf2e0 into main Jul 31, 2023
@matheus23 matheus23 deleted the matheus23/improve-performance branch July 31, 2023 12:34
@github-actions github-actions bot mentioned this pull request Aug 3, 2023
This was referenced Aug 11, 2023
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