tee: improve throughput by raw syscall#12131
Conversation
|
is it possible to have a codspeed benchmark to evaluate the win? |
|
I don't know how to connect stdin to CodSpeed. |
|
i asked on discord |
This comment was marked as outdated.
This comment was marked as outdated.
|
We should also support syscall failure on I/O benchmarks (inparticular for splice(2)). |
This comment was marked as outdated.
This comment was marked as outdated.
|
It might syscall-time bounded bench. If so, we cannot use CodSpeed. |
|
GNU testsuite comparison: |
| } | ||
| } | ||
|
|
||
| #[cfg(not(unix))] // todo: investigate how to improve throughput |
There was a problem hiding this comment.
There was a problem hiding this comment.
I think unsafe is needed if we want do same things for for WIndows.
72a2adc to
e81feb1
Compare
|
The fn write(&mut self, buf: &[u8]) -> Result<()>Additionally, avoiding |
|
I don't want to manually write loop writing all of buf.
|
|
This impl is because |
|
I still think its's confusing to implement |
|
I can add comment instead. We need 2 duplicated write_all definitiols for Stdout anf File if we manually loop. |
|
I was thinking something like this: b0edaae |
|
No. Because write syscall does not guarantee writing everything. Needs loop and take sum of returned values. |
|
It would solve many problems if we could use |
|
Private? Is it need to copy and paste unsafe code to uucore? |
|
The issue we’re working around is that |
|
https://docs.rs/rustix/latest/rustix/stdio/fn.stdout.html but unix only... |
|
We already have a solution in |
|
Hmm... it has try_clone. So introducing new overhead? |
|
We cannot use it #12157 |
Merging this PR will improve performance by ×17
Performance Changes
Comparing Footnotes
|
|
+syscall time is still better |
Remove flush overhead and use raw syscall for POSIX tee requirement.
I was really surprised that
std::iohas such overhead.