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

Reintroduce Optimization of Entry::getItem() #836

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

kelson42
Copy link
Contributor

@kelson42 kelson42 commented Nov 4, 2023

Fixes #769

For a client of libzim the only way to create an Item object is through Entry::getItem() or Entry::getRedirect() (the latter relying on the former to deliver the final result).

Before this change, Entry::getItem() performed (via the Item constructor) an extra call to FileImpl::getDirent(entry_index_t). Now the result of that operation that is readily available in the source Entry object is reused.

For a client of libzim the only way to create an `Item` object is
through `Entry::getItem()` or `Entry::getRedirect()` (the latter
relying on the former to deliver the final result).

Before this change, `Entry::getItem()` performed (via the `Item`
constructor) an extra call to `FileImpl::getDirent(entry_index_t)`.
Now the result of that operation that is readily available in the source
`Entry` object is reused.
@kelson42 kelson42 marked this pull request as ready for review November 4, 2023 10:19
Copy link

codecov bot commented Nov 4, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (2a810ac) 57.57% compared to head (c23d43e) 57.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #836      +/-   ##
==========================================
- Coverage   57.57%   57.57%   -0.01%     
==========================================
  Files          98       99       +1     
  Lines        4545     4542       -3     
  Branches     1911     1909       -2     
==========================================
- Hits         2617     2615       -2     
  Misses        668      668              
+ Partials     1260     1259       -1     
Files Coverage Δ
include/zim/entry.h 100.00% <ø> (ø)
include/zim/item.h 100.00% <100.00%> (ø)
src/entry.cpp 60.60% <100.00%> (+3.03%) ⬆️
src/item.cpp 57.57% <66.66%> (-5.59%) ⬇️

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

@mgautierfr mgautierfr merged commit 176c73b into main Nov 6, 2023
31 of 32 checks passed
@mgautierfr mgautierfr deleted the reintroduce-entry-getitem-optim branch November 6, 2023 10:43
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.

Reintroduce Entry::getItem optimization in next api/abi release.
3 participants