Git Product home page Git Product logo

Comments (6)

sharifhsn avatar sharifhsn commented on May 27, 2024

What do you expect the behavior to be in this instance?

from hexyl.

GrigorenkoPV avatar GrigorenkoPV commented on May 27, 2024

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.

  1. Spitting out a bunch of zeroes as xxd does. But I guess it goes against the design of hexyl.
  2. The zeroes before the skipped part. Let me explain.
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.

from hexyl.

sharkdp avatar sharkdp commented on May 27, 2024

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.

from hexyl.

sharifhsn avatar sharifhsn commented on May 27, 2024

Great, I'll look into fixing this today.

from hexyl.

sharifhsn avatar sharifhsn commented on May 27, 2024

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.

from hexyl.

sharkdp avatar sharkdp commented on May 27, 2024

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.

from hexyl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.