Fix: Write stdout directly to avoid time comsumption without --dump-response option#2221
Conversation
| buf[..read].to_vec(), | ||
| ) | ||
| }); | ||
| self.stdout_writer.write_all(&buf[..read]).ok(); |
There was a problem hiding this comment.
Without the from_utf8_unchecked() then we risk binary being printed to stdout, which can cause terminal corruption
There was a problem hiding this comment.
Your right.
And I found that it seems normal to take time when calling large file. I need to check real issue situation and debug it again.
I've asked the one who issued this to provide reproducible example.
|
Hello @YoussefBaccouch . I've been working with this issue (the one that you asked in #2200) and debugging all the internal logics. I think it seems normal that it takes time to call massive files. Thanks :) |
Hello team.
This PR Closes #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.
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.