[hashcash] Re: status of hashcash version 1?

Plus need to integrate Chromatix fast hashcash code.  Think main issue
there is to have a way to know which code to run on a machine based on
eg some CPU properties code so it is fast, or a very short trial of
the set of alternatives that run on the CPU to measure which is best.

My code already includes mechanisms to do both of these.

Each core is associated with a "test" function which rapidly determines whether the code can run or not - this is how, eg, the Altivec cores are disabled on pre-G4 PowerPCs and on other architectures. While I haven't actually tested the code on a non-MMX PC, the MMX cores should disable themselves correctly too.

There is then a "static" prediction function which chooses a default scalar core based on the architecture at runtime, and then scans the vector cores to see which is the "most advanced" one that will run. This static prediction is reflected in an asterisk beside one of the cores in the verbose benchmark output. In fact, the static prediction is done as part of the (mandatory) initialisation, so you can't miss it.

The provided benchmark function updates the preferred-core pointer based on the results of the benchmark. The verbosity seen in the user version of the benchmark can be competely turned off for internal use already. If the benchmark size is adjusted to take a minimal length of time (while still being sufficiently accurate), this should automatically do what you want. This works best when the benchmark can be run once before a large, continuous batch of work.

HTH,

--------------------------------------------------------------
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: