(no title)
anonymous-panda | 1 year ago
The amount of input data is just laughably small here to result in a huge timing discrepancy.
I wonder if there’s an added element where the constant syscalls are reading on a contended mutex and that contention disappears if you delay the start of the program.
vlovich123|1 year ago
> INFILE="$(mktemp)" && echo $INFILE && \ echo '60016000526001601ff3' | xxd -r -p > "${INFILE}" && \ zig build run -Doptimize=ReleaseFast < "${INFILE}" > execution time: 27.742µs
vs
> echo '60016000526001601ff3' | xxd -r -p | zig build run -Doptimize=ReleaseFast > execution time: 27.999µs
The idea that the overlap of execution here by itself plays a role is nonsensical. The overlap of execution + reading a byte at a time causing kernel mutex contention seems like a more plausible explanation although I would expect someone better knowledgeable (& more motivated) about capturing kernel perf measurements to confirm. If this is the explanation, I'm kind of surprised that there isn't a lock-free path for pipes in the kernel.
mtlynch|1 year ago
Here are the benchmarks before and after fixing the benchmarking code:
Before: https://output.circle-artifacts.com/output/job/2f6666c1-1165...
After: https://output.circle-artifacts.com/output/job/457cd247-dd7c...
What would explain the drastic performance increase if the pipelining behavior is irrelevant?
rofrol|1 year ago