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

index: only iterate over trie items once #465

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

pmrowla
Copy link
Contributor

@pmrowla pmrowla commented Nov 30, 2023

No description provided.

@pmrowla pmrowla self-assigned this Nov 30, 2023
@@ -687,8 +687,9 @@ def _load(self, key, entry):
self._trie.commit()

def load(self, **kwargs):
for key, entry in self.iteritems(shallow=True, **kwargs):
self._load(key, entry)
kwargs["shallow"] = True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this would cause an error before if someone called load(shallow=True)

Comment on lines +722 to +724
for key, entry in self._trie.items(prefix=prefix, shallow=shallow):
self._load(key, entry)

yield from self._trie.items(**kwargs)
yield key, entry
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sqltrie items() allows for loading children during iteration now so we do not need to iterate over the trie twice

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6cba666) 63.81% compared to head (f4d0fac) 63.80%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #465      +/-   ##
==========================================
- Coverage   63.81%   63.80%   -0.01%     
==========================================
  Files          61       61              
  Lines        4118     4117       -1     
  Branches      706      706              
==========================================
- Hits         2628     2627       -1     
  Misses       1344     1344              
  Partials      146      146              

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

@pmrowla pmrowla merged commit f36700c into iterative:main Nov 30, 2023
13 of 14 checks passed
@pmrowla pmrowla deleted the index-iteritems branch November 30, 2023 07:53
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