HexOut

Binary: HexOut_1.1_Binary

Source: HexOut_1.1_Source (includes binary)

Update (2016/07/31)
Version 1.1 fixes a few bugs and removes the max column limit of 16. Also, Usage is updated to indicate that each column displays 8 bytes at a time.

About

HexOut is an extremely fast and flexible interactive console hex viewer.  It is ideal for viewing the raw contents of small to medium size files.  The target audience is developers and IT support although it may be of benefit to others as well.

Two downloads are available.  The Binary version only includes the executable (23KB) and the ReadMe file (which includes instructions on command line operation).  The Source archive includes the (clean) Visual Studio 2012 project plus the executable.

Background

When I started working at Microsoft fresh out of college nearly 20 years ago one of the first utilities I wrote was a file viewer named HexOut.  You specify the input file and it would print out both the hex and ASCII value of each line of bytes.  It isn’t an editor as you can only view the file, but it has proven to be indispensable and I’m still using it. But I felt the need to update it for some additional functionality.

I decided to rewrite it in C# rather than the original C++, but my primary concern was performance.  The old HexOut has been extremely fast and rock solid and native C++ was a natural choice for manipulating byte arrays.

I spent a few days writing and refining the new version.  It has far more features and an interactive mode and is far more flexible and friendly than the old version.  I ran some performance tests that identified hot spots in the code.  After fixing those I’ve been pleased with the performance.

Performance

On files under a few megabytes in size the parse time is less than a second for each version so I needed to compare performance on a large file instead.  I chose an 800MB file that I had sitting around.  The output size is roughly 4GB.  This is an extreme case.

The old version took 181 seconds.  The new version took 163 seconds for a 10% speed increase.  That is roughly 5MB of input file parsed and 24MB / 300,000 lines out per second.  (Both versions were CPU-bound and the input file had already been read into memory.)

Clearly you can write performant code in C#.

License

I’m releasing this under the MIT License.  Details are in the ReadMe.