« first day  last day (14 days later) » 

2:15 AM
What command are you using to generate your input? I'd be interested in a tool to just generate stuff like that.
 
2:32 AM
And I do see a speedup with your code, slightly tweaked: buffer.lines().filter_map(|x| x.ok()).fold(0u, |a, s| a + s.char_len())
For my file, it's almost 3x as fast
Which feels like a bug in Rust - I wouldn't expect that much difference
 
2:58 AM
And the "dangerous slice" link has to be a bug. I've opened github.com/rust-lang/rust/issues/19634
 
3:28 AM
Also, my timing numbers were off. I wasn't compiling with optimization
Naive way: 1.361s, your way: 0.817s
for the same 116524419 byte file
or ~85 MB/sec and ~142 MB/sec
 
 
5 hours later…
8:23 AM
Concerning the command generating input, it's just a few line of code which behave like the command "yes": a BufferedWriter around stdout_raw which will do writer.write(text.as_bytes()) in a loop.
 
8:43 AM
Note that the command "bc" count the bytes, and our tests count the utf-8 characters. Thank you for notifying the bug. For the clone issue, I guess that what is missing is that the copy should have the same lifetime than the original, as it is the case for .slice_from
 

« first day  last day (14 days later) »