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

HashSet iteration on drop not elided for Copy elements #31711

Closed
bluss opened this issue Feb 16, 2016 · 2 comments
Closed

HashSet iteration on drop not elided for Copy elements #31711

bluss opened this issue Feb 16, 2016 · 2 comments
Labels
A-collections Area: std::collections. I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@bluss
Copy link
Member

bluss commented Feb 16, 2016

If a HashSet has Copy elements, it doesn't need to visit all elements on drop. The iteration in RawTable's drop still is computed even if the elements have no destructors, which leads to O(n) average complexity even then.

@bluss bluss added I-slow Issue: Problems and improvements with respect to performance of generated code. A-collections Area: std::collections. labels Feb 16, 2016
@hanna-kruppe
Copy link
Contributor

To be clear, this is also in release mode, right? A while back there was a similar issue for vec but AFAIK that one was only about debug mode.

@bluss
Copy link
Member Author

bluss commented Feb 16, 2016

Yes, also in release mode.

bors added a commit that referenced this issue Feb 17, 2016
This changes the performance of `drop` from linear to constant time for such `HashMap`s.

Closes #31711.

r? @bluss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-collections Area: std::collections. I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

2 participants