Hello!
I’ve investigated tagged integer arithmetic and implemented an
optimization that makes ‘1+’ and ‘1-’ on fixnums almost twice as fast
(haven’t tried the rest yet):
- Before:
("arithmetic.bm: fixnum: 1+" 10000000 user 11.54 benchmark 10.2048559570312
bench/interp 10.2048559570312 gc 0.0)
("arithmetic.bm: fixnum: 1-" 10000000 user 11.51 benchmark 10.1748559570313
bench/interp 10.1748559570313 gc 0.0)
- After:
("arithmetic.bm: fixnum: 1+" 10000000 user 6.43 benchmark 5.09485595703125
bench/interp 5.09485595703125 gc 0.0)
("arithmetic.bm: fixnum: 1-" 10000000 user 6.44 benchmark 5.10485595703125
bench/interp 5.10485595703125 gc 0.0)
The idea is nicely described in “Representing Type Information in
Dynamically Typed Languages”, D. Gudeman, 1993,
<ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/pubs/typeinfo.ps.gz>.
Fun! :-)
Thanks,
Ludo’.