sort: Replace malloc and 0 fill with huge reserve & min 0 fill#10975
sort: Replace malloc and 0 fill with huge reserve & min 0 fill#10975oech3 wants to merge 1 commit intouutils:mainfrom
Conversation
Merging this PR will improve performance by 64.53%
Performance Changes
Comparing Footnotes
|
| } else if estimated == 1 { | ||
| const LINE_LEN_HINT: usize = 32; | ||
| estimated = (read.len() / LINE_LEN_HINT).max(1); | ||
| const LINE_LEN_HINT: usize = 128; |
There was a problem hiding this comment.
@mattsu2020 how did you decide to use 32 for LINE_LEN_HINT in the existing code?
There was a problem hiding this comment.
We can define const MAYBE_LN_CACHE_SIZE: usize for everywhere.
e875422 to
204214a
Compare
|
I think mimalloc benchmark is useful to investigate malloc cost even if we decided to not adopt it. |
|
GNU testsuite comparison: |
| if buffer.len() < carry_over.len() { | ||
| buffer.resize(carry_over.len() + 10 * 1024, 0); | ||
| buffer.resize(carry_over.len(), 0); | ||
| let new_len = (carry_over.len() * 2) |
There was a problem hiding this comment.
please add a comment explaining why
src/uu/sort/src/chunks.rs
Outdated
| GeneralBigDecimalParseResult, GlobalSettings, Line, SortMode, numeric_str_cmp::NumInfo, | ||
| }; | ||
|
|
||
| const MAYBE_LN_CACHE_SIZE: usize = 64 * 1024; |
There was a problem hiding this comment.
what does the variable name MAYBE_LN_CACHE_SIZE mean?
sort: Save RAM usage
3be05e9 to
635e73f
Compare
|
GNU testsuite comparison: |
Found at #10954