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
drop, take and slice methods on VectorIterator should not consume linear time #9954
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9954?orig=1 |
Can I pick this one? I need some guidance on how should i approach it. |
This change is most likely not binary compatible (I haven't checked), so it has to target 2.13. In this case, it does not make sense to fix it in the current source code under scala/scala, as the collections library is being reworked at https://github.com/scala/collection-strawman. You could check in the new implementation if the issue is already fixed (or maybe @szeiger knows). |
the 2.13 collections are now far enough along that now would be a good time for someone to check if this is resolved there yet or not. |
It does not seem to be resolved yet - It might be worth looking to solve this in general for |
The more general optimizations could be added to This won't be any use for |
Sequential indexing can often be optimized surprisingly well, but the custom iterator shaves off another 15% of the runtime. Also, it can't always be optimized that well (if the loop is more complex), and then there's a major penalty (~10x, if you have to dig all the way down the 32-wide tree each time). |
|
|
...and fix the `drop` implementation which didn’t ensure that the remaining size is reported as 0 when all remaining elements are dropped. Fixes scala/bug#9954
...and fix the `drop` implementation which didn’t ensure that the remaining size is reported as 0 when all remaining elements are dropped. Fixes scala/bug#9954
As an
IndexedSeq
,VectorIterator
does not implement its owndrop
,take
andslice
at the moment.The default implementation in
Iterator
takes linear time.This issue also affects views of
Vector
s.The text was updated successfully, but these errors were encountered: