[hashcash] Speed problem with 1.03 on Mac G4

  • From: hal@xxxxxxxxxx ("Hal Finney")
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Sun, 15 Aug 2004 09:42:16 -0700 (PDT)

I tried the latest version (1.03) on an iBook with a 1 GHz G4.

First, I had never heard the term "altivec" before.  I knew enough to
disable the -mmmx and such in the Makefile, but it would be nice to
have some comments there, or in the README, to hint about what people on
other architectures should do.  I did "man gcc" and searched for altivec,
and discovered the -faltivec flag.  So I put that in place of the -mmmx
and other Intel stuff.

The program still did not build, apparently due to a compiler bug.
The error was:


cc -O -O3 -funroll-loops -faltivec  -DREGEXP_POSIX -DCHROMATIX     -c -o 
fastmint_altivec_compact_2.o fastmint_altivec_compact_2.c
/var/tmp//ccsrKO5q.s:758:FATAL:Symbol myword12 already defined.


I took out the -O3 and left the -O and then it compiled OK.
cc --version prints:
cc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1495)


fastmint_benchtest produced the following edited speed report:

    Rate  Name (* machine default)

  1092927 ANSI Compact 1-pipe  
  1003708 ANSI Standard 1-pipe  
   933830 ANSI Ultra-Compact 1-pipe  
  1239875 ANSI Compact 2-pipe  
   905185 ANSI Standard 2-pipe  
  4098477 PowerPC Altivec Standard 1x4-pipe  
  4215577 PowerPC Altivec Compact 2x4-pipe  
  4339564 PowerPC Altivec Standard 2x4-pipe *


Nice and fast.  Now, the problem is that hashcash -m takes 8-10
seconds before printing the estimated time.  And then after that
it takes about another 5-7 seconds longer than estimated.  Here is
a typical run:

$ time ./hashcash -m -b 20 -r test
time estimate: 0 seconds (242 milli-seconds)
hashcash token: 1:20:040815:test::3Y5ZCsKkkYUATBfw:000032Rr

real    0m17.015s
user    0m16.620s
sys     0m0.200s

I did this four times and the time taken varied from 16.9 to 17.5 seconds.

I did some 23-bit trials and it estimated 2 seconds but took from 17 to 22
seconds.

It appears that there is about a 17 second overhead for, presumably,
choosing the best architecture.  That's OK if you're generating a big
stamp, but it is probably not acceptable for applications which rely on
small stamps.

Hal Finney

Other related posts: