POW Code optimization (about 4% faster)

in pow •  9 years ago 

There are 2 small optimizations that can be made to the pow algorithm to speed it up by a few %

  • the first hash is calculated for every nonce, but it only changes once per block. Precalculate it and save one sha256 per nonce.
  • don't check if the miner shoud stop every nonce. Once every 50 is plenty.

Changes are only made to:
libraries/plugins/witness/witness.cpp

Here is the diff:
http://hastebin.com/raw/ecifidawiz

And here the full file with changes:
http://hastebin.com/raw/egajuyuguq

just run make after changing this and restart the client.
Like if you like!

It can be combined with the gmp/mpir modification. Btw, compiling libgmp yourself also adds some hashes!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...

Great work!

Can confirm increase of hashrate by 4%.

Congratulations @bu328281! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 3 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!