Closed GrigorenkoPV closed 6 months ago
What do you expect the behavior to be in this instance?
What do you expect the behavior to be in this instance?
Anything but empty output, which makes it impossible to tell if anything is happening at all.
hexyl
.dd if=/dev/zero count=5000B | hexyl
outputs
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│* │ ┊ │ ┊ │
│00001380│ 00 00 00 00 00 00 00 00 ┊ │⋄⋄⋄⋄⋄⋄⋄⋄┊ │
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
so it would be cool if
hexyl /dev/zero
printed
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│* │ ┊ │ ┊ │
and then hanged. So yeah, basically just flushing the output after the *
row.
So yeah, basically just flushing the output after the
*
row.
Agreed. This is also what hexdump -C
and xxd -a
(-a = autoskip = squeezing) do.
Thank you for reporting this.
Great, I'll look into fixing this today.
It looks like the issue is a simple one-liner: the write buffer isn't flushed until the very end of output. I wrote it this way initially to mitigate performance issues from flushing the buffer, but benchmarks show that the effect is negligible. I've added a line that will flush after every line.
It looks like the issue is a simple one-liner: the write buffer isn't flushed until the very end of output. I wrote it this way initially to mitigate performance issues from flushing the buffer, but benchmarks show that the effect is negligible. I've added a line that will flush after every line.
Thank you very much for looking into this! Any chance you could share those benchmark results? I also would have expected repeated flush calls for every line to be performance-relevant.
So does
or
I guess it has to do with hexyl's feature where it skips null rows and prints only the first and the last.