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 _scan() #212

Merged
merged 1 commit into from Aug 27, 2018
Merged

Optimize _scan() #212

merged 1 commit into from Aug 27, 2018

Conversation

thedrow
Copy link
Contributor

@thedrow thedrow commented Aug 27, 2018

In case that a regular expression is specified, it is not needed to copy all the keys if some of them do not match the regular expression.
If a regular expression is not provided, there is no need to iterate over the slice. Instead, we simply copy the entire slice.
This is useful in cases where we're dealing with a large number of keys.

In case that a regular expression is specified, it is not needed to copy all the keys if some of them do not match the regular expression.
If a regular expression is not provided, there is no need to iterate over the slice. Instead, we simply copy the entire slice.
This is useful in cases where we're dealing with a large number of keys.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.484% when pulling 72ff3c2 on thedrow:patch-1 into 8098106 on jamesls:master.

@thedrow
Copy link
Contributor Author

thedrow commented Aug 27, 2018

I'm genuinely surprised there are no "off by one" errors 🤣

Copy link
Collaborator

@bmerry bmerry left a comment

Choose a reason for hiding this comment

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

Thanks, looks good. I wonder if it would be faster to use a list comprehension instead of a looped append in the case where a pattern is supplied.

@bmerry bmerry merged commit c729b18 into jamesls:master Aug 27, 2018
@thedrow thedrow deleted the patch-1 branch August 27, 2018 12:31
@thedrow
Copy link
Contributor Author

thedrow commented Aug 27, 2018

Feel free to check. I don't think there will be much of a difference.
I think we gained most of the performance boost we could here.

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

3 participants