Live data from Hacker News

Hexyl: A command-line hex viewer

github.com

101–110 of 119 posts

Re: Hexyl: A command-line hex viewer

#101
post #87
post #62

Earlier quoted context omitted.

The logo shows a small part of this molecule: https://en.wikipedia.org/wiki/Hexanitrodiphenylamine .. which is apparently also called "Hexyl". Granted, I was just looking for a short word that starts with "Hex" and I was never good at organic chemistry :-)

Many of your projects have cool logos, how do you make them?

Thank you. Not all of them are by me, but I typically just use Inkscape.

Re: Hexyl: A command-line hex viewer

#102
post #97

Earlier quoted context omitted.

You may be able to speed things up by using a lookup table instead of branching. (If it's spending a lot of time in Rust's format function you could also use a (or the same) lookup table to convert to hex/dec/oct.)

The format function is going to end up allocating a string for every single byte. That's a huge overhead. Edit: Turns out to be about 22% overhead, see https://github.com/sharkdp/hexyl/pull/23 . Also it was 2 strings per byte, not 1.

Thanks to that PR, hexyl is now slightly faster than hexdump. Both are about a factor of 2-3 slower than xxd:

    Benchmark #1: hexyl $(which hexyl)
      Time (mean ± σ):     169.8 ms ±   8.2 ms    [User: 152.5 ms, System: 17.1 ms]
      Range (min … max):   162.2 ms … 189.1 ms    16 runs
     
    Benchmark #2: hexdump -C $(which hexyl)
      Time (mean ± σ):     188.5 ms ±   4.4 ms    [User: 186.2 ms, System: 2.2 ms]
      Range (min … max):   184.1 ms … 198.2 ms    14 runs
     
    Benchmark #3: xxd $(which hexyl)
      Time (mean ± σ):      72.8 ms ±   2.7 ms    [User: 71.9 ms, System: 1.1 ms]
      Range (min … max):    71.0 ms …  87.8 ms    40 runs

Re: Hexyl: A command-line hex viewer

#103
post #81

Earlier quoted context omitted.

... and I have already used hyperfine to benchmark hexyl as well :-) Yes, it's a shame. But I don't think there is too much we can do about it. We have to print much more to the console due to the ANSI escape codes and we also have to do some conditional checks ON EACH BYTE in order to colorize them correctly. Surely there are some ways to speed everything up a little bit, but in the end I don't think its a real issu…

We have to print much more to the console due to the ANSI escape codes and we also have to do some conditional checks ON EACH BYTE in order to colorize them correctly. A few extra comparisons and output for each byte shouldn't be that much slower; fortunately the function of this program is extremely well-defined, so we can calculate some estimates. Assuming a billion instructions per second, taking ~1.5s to hexdump…

It seems I was wrong. The new hexyl version is significantly faster (see my other comment)

Re: Hexyl: A command-line hex viewer

#104
post #6

While reading this my hope was it not being written in JavaScript. I'm not disappointed ;)

It's comparably slow though :p xxd `which hexyl` > /dev/null 0.12s user 0.09s system 99% cpu 0.219 total hexdump `which hexyl` > /dev/null 0.19s user 0.05s system 91% cpu 0.256 total hexyl `which hexyl` > /dev/null 1.69s user 0.39s system 95% cpu 2.175 total

Fixed in v0.3.1 (https://github.com/sharkdp/hexyl/releases/tag/v0.3.1) :-)

Re: Hexyl: A command-line hex viewer

#105
post #98

Cool tool :) having a hex dumper that understood UTF-8 and dumped the characters as one of the columns would be awesome too. These days, ASCII is a small subset of strings.

Thank you! See: https://github.com/sharkdp/hexyl/issues/6

Just a minor thing while you're eyeballing this thread: I noticed your fork of lsd has the wrong build instructions.

https://github.com/sharkdp/lsd#from-sources

Good work on these tools though. You make me want to learn Rust :)

Re: Hexyl: A command-line hex viewer

#106
post #96

Earlier quoted context omitted.

Rust binaries can be large because unlike C, the standard library is statically linked, as well as jemalloc. Jemalloc will no longer be the default as of the next release, so that will shave off ~300k...

What's replacing Jemalloc?

The system malloc implementation. Users who want to use jemalloc have to opt in, but doing so is relatively easy (using the jemallocator crate from crates.io).

Re: Hexyl: A command-line hex viewer

#107

Earlier quoted context omitted.

Thank you! See: https://github.com/sharkdp/hexyl/issues/6

Just a minor thing while you're eyeballing this thread: I noticed your fork of lsd has the wrong build instructions. https://github.com/sharkdp/lsd#from-sources Good work on these tools though. You make me want to learn Rust :)

I forked lsd just to fix these build instructions: https://github.com/Peltoche/lsd/pull/33

I removed my fork...

Re: Hexyl: A command-line hex viewer

#108

Earlier quoted context omitted.

Just a minor thing while you're eyeballing this thread: I noticed your fork of lsd has the wrong build instructions. https://github.com/sharkdp/lsd#from-sources Good work on these tools though. You make me want to learn Rust :)

I forked lsd just to fix these build instructions: https://github.com/Peltoche/lsd/pull/33 I removed my fork...

Ahhh yes. Apologies.
Post reply on HN