This is an automated archive made by the Lemmit Bot.

The original was posted on /r/rust by /u/_intentional_focus on 2023-11-04 21:24:28.


I’ve been learning Rust off and on for a while now and recently “finished” my simple wc alternative - rrwc. (Which stands for Ryan’s Rust WC - so clever, I know).

Currently, wc is faster on files smaller than 200 kb (which is like 35000 words of a book - a big file!), getting up to 33% faster on a 1 or 2 word file. For large files, my Rust implementation is faster, approaching about 2.1 times faster as you get towards files larger than 20Mb (that’s a big text file!). (Obviously, ymmv - I’ve only tested on my computer.)

I learned a ton doing this project, and wanted to share with the community!

I’d also love any tactful and helpful feedback, in particular, I don’t really understand what, if any, performance improvement options there are for small files - the Rust process of finding a file and starting the program seems inherently slower than wc’s c++ version.