Calculating mining speed, it’s not what you thought.

I just updated Coco blockchain. I changed the way the mining speed is calculated.

The mining process is as a stand-alone job. Multiple such miners can run simultaneously, each of the miners is reporting how many hashes it calculated during one second. The is collected by the UI, combined and presented to the user as the mining speed.

In my first implementation, I had a queue, sorted by the creation date of the miners reports, I limited it to 1000 entries and calculated the speed as an average of those reports.

I found the min report time and the max report time, calculated the delta and then calculated the total mining speed as the total hashes in all the reports in the queue divided by the delta time.

However, I discovered that this calculation is incorrect as during the reporting of one miner the other miners continue to work, so I am losing part of the time. I thought it would result in a much bigger mistake then it ended up to be. But still, there is a much more simple and accurate solution.

The better solution is to not work with a queue but simply take the last report from each of the miners and calculate the time as the total time it took for the miners to produce the report and then divide the total hashes by that time.

Surprisingly the old method was only 5% wrong when comparing to the new one. The actual mining speed turned out to be a bit faster than the older measurements.

submitted by /u/TheOriginalCoco

You might also like
Leave A Reply

Your email address will not be published.