[hashcash] Re: Hashcash performance improvements

  • From: Jonathan Morton <chromi@xxxxxxxxxxxxxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Thu, 27 May 2004 19:39:07 +0100

>> I strongly suggest overhauling timer.c - ATM it uses "wall time"
>> instead of "CPU time", which is probably where a lot of the variance
>> comes from, and it has rather low resolution on some machines.  I use
>> clock() in my code, which tends to have at least 1/60 sec resolution,
>> and works on CPU time rather than wall time.
> Well I'd sooner have really high resolution so I do not have to run
> code for long, chewing of real-time during minting to estimate speed.
> I presume in practice it is a lot better than 1/60 sec?

On MacOS Classic it's 1/60 sec, on UNIX it's likely to be centisecond 
or millisecond.

If you're concerned about wasting effort, there's a mechanism in 
libfastmint which lets you run a minter for a limited number of 
iterations.  You can then time how long those take, and check to see if 
it produced a real result that quickly.

I need to do a little work on the backends to make entirely sure they 
are well-behaved in that situation, however.

from:     Jonathan "Chromatix" Morton
mail:     chromi@xxxxxxxxxxxxxxxxxxxxx
website:  http://www.chromatix.uklinux.net/
tagline:  The key to knowledge is not to rely on people to teach you it.

Other related posts: