Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up PoW verification hashing #160

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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.

None yet

2 participants