Subject: Re: Performance tuning
From: Erik Naggum <erik@naggum.net>
Date: 2000/12/05
Newsgroups: comp.lang.lisp
Message-ID: <3185044115971786@naggum.net>

* "Marc Battyani" <Marc.Battyani@fractalconcept.com>
| Why did you not use LDB to access parts of the bignums?

  Mainly because it failed to inline.

| Direct memory access must be faster, but are there other reasons?

  Not really.  LDB should have been able to do this, but it gets
  somewhat specialized before it can be optimized really heavily.

| About SETF LDB the HS says : "setf may be used with ldb to modify a
| byte within the integer that is stored in a given place. The order of
| evaluation, when an ldb form is supplied to setf, is exactly
| left-to-right. The effect is to perform a dpb operation and then store
| the result back into the place. "

  Unfortunately, this "place" is not the bignum, but the binding that
  holds the bignum.  I have never seen a dbp on a bignum return a bignum
  eq to the previous value, but I expected just that when I first wanted
  to use dpb on bignums.

| I wonder why there is no destructive version of SETF LDB that would modify
| the given integer?
| This would certainly be useful.

  I agree that this would be very useful with bignums, but I have not
  seen much significant optimization of bignum arithmetic, and I might
  understand why: This implementation of MD5 is the first time I have
  needed to hack bignums fast.  I guess it would help if bignums were
  used a lot and that performance matters more to more Common Lisp users
  -- optimizing bignum arithmetic is hard work and needs assembly code
  to be _really_ efficient.

#:Erik
-- 
  "When you are having a bad day and it seems like everybody is trying
   to piss you off, remember that it takes 42 muscles to produce a
   frown, but only 4 muscles to work the trigger of a good sniper rifle."
								-- Unknown