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

performance improvement: create only one instance of _Filterer #674

Merged
merged 1 commit into from
Oct 25, 2020

Conversation

tyarimi
Copy link
Contributor

@tyarimi tyarimi commented Oct 20, 2020

_Filterer is stateless, so no need to initialize it on every call to filter_applies. It cuts the filtering time by ±30%.


This change is Reviewable

@codecov
Copy link

codecov bot commented Oct 20, 2020

Codecov Report

Merging #674 into develop will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #674   +/-   ##
========================================
  Coverage    95.44%   95.44%           
========================================
  Files           19       19           
  Lines         3558     3559    +1     
========================================
+ Hits          3396     3397    +1     
  Misses         162      162           
Impacted Files Coverage Δ
mongomock/filtering.py 98.96% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8909c05...ec3c3f0. Read the comment docs.

@tyarimi
Copy link
Contributor Author

tyarimi commented Oct 20, 2020

@pcorpet can you please review and merge this PR? it improves performance dramatically.

@pcorpet
Copy link
Member

pcorpet commented Oct 25, 2020

Thanks for the proposal. Note that the Filterer object was introduced for adding new features (that haven't made it yet to the main branch) and that I'll probably have to roll it back later on. As for now, if you're indeed seeing a +30% for performances, it's certainly worth it.

@pcorpet pcorpet merged commit 958efb2 into mongomock:develop Oct 25, 2020
@tyarimi
Copy link
Contributor Author

tyarimi commented Oct 26, 2020

@pcorpet thanks for merging the PR! I will try to find some time to introduce more performance improvements to the filtering logic, as we have thousands of tests depending on it.

@tyarimi tyarimi deleted the single-filterer branch October 26, 2020 08:57
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.

None yet

2 participants