3 ms·
A language allowing high performance code doesn't mean it automatically guarantees high performance code. The latter is essentially impossible. One common pitf
by dbaupp 10y ago
A language allowing high performance code doesn't mean it automatically guarantees high performance code. The latter is essentially impossible.
One common pitfall is not turning the optimiser on (with --release for cargo) i.e. benchmarking a debug build rather than a release one, and from a quick glance this code looks like it may be doing a system call to read each and every byte of the file due to the use of .bytes() on an unbuffered file, whereas it would be better to use, say, read_to_end to read many bytes of the file at once.