-
Notifications
You must be signed in to change notification settings - Fork 16
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
Speed up arg_to_iter #51
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #51 +/- ##
==========================================
- Coverage 99.25% 99.24% -0.01%
==========================================
Files 4 4
Lines 267 266 -1
==========================================
- Hits 265 264 -1
Misses 2 2
|
The documentation issue is caused by scrapy/scrapy#5402 |
So I guess this changes the result from true to false for some types not listed in isinstance? |
It does. I think supporting only a limited number of iterables as input for values is a low price for this much of a performance improvement. To be honest, I would have even dropped generator support be it not for the existing tests for it. I think it would be best to document the specific iterables that are supported as input for values, limit the implementation to that subset, and let users do the required conversion for scenarios where custom types are needed. Not a strong opinion, though. But since |
@Gallaecio Any chance of keeping the |
Seems reasonable to me, feel free to open a PR. |
Fixes #50
If we restrict the subset of sequence and generator types that we allow
arg_to_iter
to handle, we can remove the use ofis_item
altogether to significantly improve its performance.I tested performance with:
Results: