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

fix clippy slow_vector_initialization #618

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

klensy
Copy link
Contributor

@klensy klensy commented May 4, 2024

Should be smaller code size

Should be smaller codegen size
@klensy
Copy link
Contributor Author

klensy commented May 4, 2024

Ahh, this should affect #[cfg(any(target_arch = "x86", target_arch = "arm"))] only.

@klensy
Copy link
Contributor Author

klensy commented May 4, 2024

Why CI ignores changes in workflow? idk.
Looks like it uses workflow from master.

@@ -409,8 +409,7 @@ pub fn init() -> Result<Init, ()> {
//
// See https://learn.microsoft.com/cpp/build/reference/pdbpath for an
// example of where symbols are usually searched for.
let mut search_path_buf = Vec::new();
search_path_buf.resize(1024, 0);
let mut search_path_buf = vec![0; 1024];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. This could be with_capacity, and then we pass the search_path_buf.capacity() when indicating how much space we have to allocate, and then we pass a search_path_buf.set_len after filling it.

...or that could be over-optimization as we are likely to get a fresh raw page from the OS because this was a calloc.

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.

None yet

2 participants