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

uucore: provide capacity for vectors #5086

Merged
merged 3 commits into from
Jul 15, 2023
Merged

Conversation

shinhs0506
Copy link
Contributor

small improvements when creating vectors

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/rm/rm2 is no longer failing!

@@ -233,7 +233,7 @@ fn test_random_big() {
// to generate an even split of this range, generate n-1 random elements
// in the range, add the desired total value to the end, sort this list,
// and then compute the sequential differences.
let mut f_bits = Vec::new();
let mut f_bits = Vec::with_capacity(n_factors);
Copy link
Contributor

Choose a reason for hiding this comment

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

There's an additional f_bits.push directly after the for-loop (line 240):

Suggested change
let mut f_bits = Vec::with_capacity(n_factors);
let mut f_bits = Vec::with_capacity(n_factors + 1);

@shinhs0506
Copy link
Contributor Author

@cakebaker thanks for the review :)

@sylvestre
Copy link
Contributor

I guess you didn't see perf improvement, right?

@sylvestre sylvestre merged commit c851d3c into uutils:main Jul 15, 2023
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.

3 participants