Skip to content

Conversation

@nnethercote
Copy link
Contributor

Some small performance wins I found while integrating ThinVec into rustc.

When `thin-vec` is included in rustc via "path" rather than via "version",
these warnings occur. They are all part of the `rust_2018_idioms` lint.
I don't really understand why they occur, but fixing them seems
harmless?
`Vec::extend` is likewise inlined.
@nnethercote
Copy link
Contributor Author

Best reviewed one commit at a time.

Currently it reserves capacity using `with_capacity`. It then calls
`extend`, which (unnecessarily) calls `reserve`. It then calls `push` N
times, each of which (unnecessarily) does a capacity check.
@nnethercote nnethercote force-pushed the opt-clone-and-extend branch from 9a72ec1 to 6780695 Compare August 19, 2022 04:47
@Gankra Gankra merged commit f23417b into mozilla:main Aug 19, 2022
@Gankra
Copy link
Collaborator

Gankra commented Aug 19, 2022

Thanks!

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.

2 participants