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

Optimize sqsh_tree_traversal_path_dup #271

Merged
merged 2 commits into from
Jul 27, 2024
Merged

Conversation

Dr-Emann
Copy link
Contributor

Compute the size, and allocate only once with the exact size. Build the path in reverse while walking the traversal stack, which avoids the need to call sqsh_tree_traversal_path_segment repeatedly (which must walk the traversal stack on each call).

In a simple benchmark (repeatedly calling sqsh_easy_tree_traversal against a simple squashfs file), this makes the entire sqsh_easy_tree_traversal call about 16% faster.

Compute the size, and allocate only once with the exact size.  Build the path
in reverse while walking the traversal stack, which avoids the need to call
`sqsh_tree_traversal_path_segment` repeatedly (which must walk the traversal
stack on each call)
Copy link

sonarcloud bot commented Jul 27, 2024

Copy link

codecov bot commented Jul 27, 2024

Codecov Report

Attention: Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 64.80%. Comparing base (5ac772d) to head (5c44c77).

Files Patch % Lines
libsqsh/src/tree/traversal.c 95.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #271      +/-   ##
==========================================
+ Coverage   64.57%   64.80%   +0.23%     
==========================================
  Files          74       74              
  Lines        5518     5532      +14     
  Branches      828      829       +1     
==========================================
+ Hits         3563     3585      +22     
+ Misses       1474     1469       -5     
+ Partials      481      478       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Gottox
Copy link
Owner

Gottox commented Jul 27, 2024

Great addition! - Thank you!

@Gottox Gottox merged commit d43c118 into Gottox:main Jul 27, 2024
17 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