Closed Gallaecio closed 10 months ago
Merging #51 (93d0dd7) into master (760e925) will decrease coverage by
0.01%
. Report is 2 commits behind head on master. The diff coverage is100.00%
.
The documentation issue is caused by https://github.com/scrapy/scrapy/issues/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 is_item
is more likely to support a wider range of values, and likely to become slower as well as a result, I think avoiding its usage here is key for performance.
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
is_item
is more likely to support a wider range of values, and likely to become slower as well as a result, I think avoiding its usage here is key for performance.
@Gallaecio Any chance of keeping the set
? :pleading_face:
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: