1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-16 02:01:05 +00:00
uutils-coreutils/src/factor
Paul Capron 324cbad7a3 factor: Don’t wrap stdin in BufReader & use lock()
stdin() is already buffered.

Locking upfront explicitely avoid the overhead of mutex locking/unlocking
everytime a new line is read. See https://stackoverflow.com/a/17546731
and https://www.reddit.com/r/rust/comments/3rj54u/how_can_i_read_char_by_char_from_stdin/cwpojn1/

The code cannot be simplified to “for line in stdin().lock().lines()”
until non-lexical lifetimes are implemented. The compiler complains at
the moment about a temporary value not living long enough/being dropped
while still borrowed. See https://github.com/rust-lang/rust/issues/33520

This commit is related to issue #1103.
2018-10-24 15:21:05 +02:00
..
build.rs Format everything using rustfmt 2018-03-12 01:20:58 -07:00
Cargo.toml Update to Rand 0.5 (#1288) 2018-10-14 13:33:44 +04:00
factor.rs factor: Don’t wrap stdin in BufReader & use lock() 2018-10-24 15:21:05 +02:00
numeric.rs Format everything using rustfmt 2018-03-12 01:20:58 -07:00
sieve.rs Format everything using rustfmt 2018-03-12 01:20:58 -07:00