Subject: Re: Beginner question: performance problems with a simple program
From: Erik Naggum <>
Date: Sat, 29 Dec 2001 17:09:00 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Janosch Zwerensky
| I just compared the two programs again, doing the equivalent of
| evaluating  (iterative-max-list 100000000) in both Lisp and C. I get
| runtimes of 746  seconds for Lisp versus 33.5 seconds for C, which is a
| 22:1 disadvantage for  Lisp :(...

  Do they return the same results?  It may sound like a stupid question,
  but you would probably be surprised to learn hown often a C solution is
  _much_ faster than a Common Lisp solution, but also very, very wrong.  If
  I want wrong results, I can get that far faster than 33.5 seconds.  :)

  I think you have run into the bignum cost in Common Lisp.  Although
  arbitrarily-sized integers is a major feature of the language, some
  implementations have not made a particular point of making bignums very
  efficient, despite the availability of very high-performance libraries.
  I find this sufficiently annoying that I have complained about it several
  times, but there is apparently no commercial value in fast bignums, and
  since I do not want to pay for reimplementing mp libraries, nor anybody
  else, it seems, nothing happens.

  You could try CLISP to see if it can give you a significant performance
  improvement, but I doubt that you can beat a 64-bit integer if you have
  the hardware support for it.  Most bignum libraries use 16- or 32-bit
  "bigits" and it is hard to make that as fast as a known size.

  It would have been so great if Common Lisp implementations could use
  machine integers if bindings/slots, etc, were so declared, but it would
  probably make garbage collection slightly harder and more expensive.

  The past is not more important than the future, despite what your culture
  has taught you.  Your future observations, conclusions, and beliefs are
  more important to you than those in your past ever will be.  The world is
  changing so fast the balance between the past and the future has shifted.