Skip to content

Conversation

@reardencode
Copy link

In a microbenchmark, this method of reversing hex bytes is an order of
magnitude faster. (100 nanoseconds vs. 1 microsecond for 10 bytes on an
Intel Core i7-5600U)

In a microbenchmark, this method of reversing hex bytes is an order of
magnitude faster. (100 nanoseconds vs. 1 microsecond for 10 bytes on an
Intel Core i7-5600U)
@SamouraiDev
Copy link
Member

SamouraiDev commented May 14, 2018

There's Utils.reverseBytes() in bitcoinj. Can get rid of the member function altogether.

@reardencode
Copy link
Author

Utils.reverseBytes is just for byte[], actually not sure why it exists since there's Arrays.reverse that is used later in calcHash. This method could also be modified to build up a byte[] instead of first building a String and then decoding it (I'm happy to do that if its your preference).

@SamouraiDev
Copy link
Member

The use of String is mainly due to reading in from JSON and then logging for debug purposes. Better to keep them around for now.

@reardencode
Copy link
Author

That was my thinking too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants