On Wed, Jun 15, 2005 at 01:06:00AM +0200, Thiemo Seufer wrote:
> Nathan Froyd wrote:
> > Unicode character strings. The patch is attached and results in a
> > compiled UB32-BASH-COPY that is roughly 20% shorter than the one resulting
> > from the current code. In particular, the new version does not have
> > fixnum arithmetic overflow checking.
> I miss here a word about the speed improvements you got. The size of a
> function usually isn't that relevant.
Aye, you have caught me violating one of the primary rules of performance
tuning: measure your optimizations! :)
That being said, I generally find that, with SBCL, shorter code is better.
Shorter code usually means less typechecking, fewer branches, and less
unnecessary work (e.g. shifting to/from fixnums). In this particular
case, when compiling UB32-BASH-COPY for PPC, the changes eliminated a
shift-fixnums-to-signed-words, add, check for overflow, cons a bignum
if necessary, and then another check to make sure the result was a
positive fixnum (!)--and all this in an inner loop. There were other
improvements, too, but that was a major one. So I feel pretty confident
in saying that the fixes will make things faster.
However, if they don't, then...I think the the large number of typechecks
done by the UB*-BASH-* family of functions to verify that their
arguments are simple-unboxed-arrays could be responsible. (More code
to execute, more branches to jump through...) Shuffling widetags to
make this checking simpler would be possible.
Nathan | From Man's effeminate slackness it begins. --Paradise Lost
The last good thing written in C was Franz Schubert's Symphony Number 9.