mmap shaves off another 15%:
use std::io::{self, Write};
fn main() -> io::Result<()> {
let input = unsafe { memmap2::Mmap::map(&io::stdin())? };
let mut lines = Vec::new();
let mut prev_idx = 0;
for idx in memchr::memchr_iter(b'\n', &input) {
let idx = idx + 1;
lines.push(&input[prev_idx..idx]);
prev_idx = idx;
}
lines.sort_unstable();
let mut out = io::BufWriter::with_capacity(64 * 1024, io::stdout().lock());
for line in lines {
Comment too long. Click here to view the full text.