bitcoin/bitcoin — pull request #1131 by laanwj (2012-04-21 18:48:30+00:00)
Title: Integrate @JoelKatz's optimized ToHex (#562) into current HexStr function

Pull request #562 was rejected because it introduced a new ToHex function with a different, potentially less safe interface.

This pull request gives most of the speed-up (~30x) of @JoelKatz his patch but rolls it into the current HexStr function. See the following benchmark results (made using https://gist.github.com/2439041).

Testing HexStrOld (1000000 iterations)
-> 14120.0 ms
Testing HexStrNew (1000000 iterations)
-> 470.0 ms
Testing ToHex (1000000 iterations)
-> 100.0 ms

It also adds two tests for HexStr: testing HexStr for the empty string and the function that takes std::vector.