-----BEGIN PGP SIGNED MESSAGE-----
content-type: text/plain; charset=us-ascii
Good question. It might be because bignum arithmetic in Scheme 48 is
implemented in Scheme. Both elk and scm do it in C. For this kind of thing,
I'd imagine *big* slowdown in moving to byte-codes. However, I'm no expert;
that is really a Scheme 48 question. Try the Scheme 48 mailing list.
One of these days I'm going to implement a cryptography toolkit in
scsh.
I looked at the core bignum implementation when I saw how slow it was
(many tens of seconds for Diffie-Hellman with a 1024 bit modulus).
Short answer:
It represents bignums in radix 2**14, using lists of fixnums. I think
this gives you a factor-of-six increase in space over a straight bit
string..
Clearly one way to speed it up it would be to rewrite the few critical
inner loops in C or prescheme, using radix 2**16 or 2**32 encoding
within byte strings as the data representation. [The real speed
demons would, of course, want to allow you to replace the inner loop
with hand-tweaked assembler so you can use add-with-carry and
32x32->64 signed multiplies..]
And now for something completely different:
Sometimes I just want to use scheme as a calculator, and see decimals
or scientific notation..
scheme48 (and other schemes in general) seem to go out of their way to
convert things to rationals, which is a great way to avoid loss of
precision, but sometimes you really want to see 4/3 as 1.33333 ...
What's the "right" way to do this in scheme?
- Bill
-----BEGIN PGP SIGNATURE-----
Version: 2.6.1
iQCVAwUBMJZ9flpj/0M1dMJ/AQE3pgP+JNbCciqv6s+IvZXrJZR8owYfJfmb9GkZ
Kqg+IUS36HEZo0KBh5uOZnW2Fxzd9EYNMtq01uX9XWsrL9rYD3+QsmxMkwTF4aWb
cDNXu27x5POOkX/Nz19TBWklvd3FCKIv75g/y7fJYF6jIHeSRXLC7LYr2q6iEqPg
D/bF34Rsh4U=
=KEQJ
-----END PGP SIGNATURE-----
|