Fix: Write stdout directly to avoid time comsumption without --dump-response option
Hello team.
This PR Closes https://github.com/cloudflare/quiche/issues/2220
I've changed response writing logic without dump option to write down stdout directly without copying and converting types.
Now there are no dramatic timp delay between the two operations.
time cargo run --bin quiche-client -- \
https://127.0.0.1:4433/1GB.bin --no-verify
Compiling quiche_apps v0.1.0 (/Users/ohyeong-geun/rust/quiche/apps)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.57s
Running `target/debug/quiche-client 'https://127.0.0.1:4433/1GB.bin' --no-verify`
cargo run --bin quiche-client -- https://127.0.0.1:4433/1GB.bin --no-verify 0.15s user 0.07s system 21% cpu 0.993 total
time cargo run --bin quiche-client -- \
https://127.0.0.1:4433/1GB.bin --no-verify \
--dump-responses /tmp
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s
Running `target/debug/quiche-client 'https://127.0.0.1:4433/1GB.bin' --no-verify --dump-responses /tmp`
cargo run --bin quiche-client -- https://127.0.0.1:4433/1GB.bin --no-verify 0.15s user 0.06s system 41% cpu 0.489 total
Additionally, I've used BufWriter to minimize system calls (If we use ``std::io::stdout().write_all()`, there might be a x8 syscalls).
Please check and leave any comments.
Thanks.
Hello @YoussefBaccouch .
I've been working with this issue (the one that you asked in https://github.com/cloudflare/quiche/issues/2200) and debugging all the internal logics.
But I discovered that when I call massive file from server, it takes pretty long time and there are no differences between --dump-responses argument usage.
I think it seems normal that it takes time to call massive files. So can you just give me a reproducible example that I can debug real problem?
Thanks :)