I created this version:
I think it is faster, mainly because of this:
1. I used a memory-mapped file, instead of using read_to_end of File.
2. I used a primitive integer number as a key, instead of a string or a vector of bytes.
3. I used custom-made field splitting code.
4. I used custom-made string-to-integer parsing.
In addition, I used ordermap::OrderMap instead of std::collections::HashMap.
I added as dependencies in Cargo.toml:
memmap = "*"
num = "*"
I build with:
cargo build --release
With my computer, it takes a minimum of 590 ms, instead of a minimum of 1083 ms with the last version by leonardo.
I left as comments the code for loading the file in a vector, instead of using a memory-mapped file, and the code using HashMap instead of OrderMap. Using HashMap the minimum time becomes 758 ms. Reading the whole file beforehand, the minimum time becomes 728 ms. Using both HashMap and File, the minimum time becomes 826 ms.