This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

scm_pseudolong vs. scm_longdigs


Hello.

In number.c, both functions scm_pseudolong and scm_longdigs are used to
transform an immediate value into a bignum.  scm_pseudolong uses the
storage space of a long value, while scm_longdigs uses a local
array.  scm_pseudolong is favored, but only used if SCM_DIGSTOOBIG is not
defined.  The distinction between these two complicates the code a lot,
thus I tried to get rid of the distinction with the attached patch to
current cvs.  Surprisingly, after applying the patch, performance goes
down.  For example, for the following benchmark:

(do ((i 0 (+ i 1)))
    ((= i 2000000))
  #t)

The result of time guile -s benchmark.scm rises 
from 4.72u 0.04s 0:04.80 99.1%
to   6.84u 0.03s 0:06.92 99.2%
on my sytem (SunOS 5.7 Generic sun4u sparc SUNW,UltraSPARC-IIi-Engine)

I don't understand this behaviour:  The above benchmark does not deal with
bignums at all, and the patch influences only those parts in numbers.c
where operations are performed with one immediate and one
bignum.  Further, the patch actually inlines the code for scm_pseudolong,
thus the procedure calling overhead should be reduced.

If the reason for the performance decrease could be found and eliminated,
this would reduce the complexity of numbers.c, since a big amount of
conditionally compiled code would be unified.

Best regards
Dirk Herrmann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]