> There is something I have not paid much attention to. > In the test, TIME says:
> Allocation = 1465806248 bytes standard / 19965 bytes fixlen
> Allocation must be the cause of the long execution time! Why does this > do-nothing test allocate that much?
It is related to the fixnum/bignum issue. Creating bignums allocates storage, unlike fixnums, which are often implemented as immediate (integer) datatypes using machine integers.
-- Thomas A. Russ, USC/Information Sciences Institute t...@isi.edu
"Ladvánszky Károly" <a...@bb.cc> writes: > Thank you for your answer, it has been most helpful for me. You are right, > most-positive-fixnum is rather small on LW and it is above my 10e8 test > count on CormanLisp. That has caused the significant difference in test > results. > Your simple solution to use nested loops is fine, it runs within 2 secs on > my machine.
An even simpler possibility is to use floating point operations for semi-long integers. Try the following:
(defun tt (nn) (declare (optimize (speed 3) (safety 0))) (loop for k of-type double-float below (float nn 1.0d0) do nil))
* Nicolas Neuss | An even simpler possibility is to use floating point operations for | semi-long integers. Try the following: | | (defun tt (nn) | (declare (optimize (speed 3) (safety 0))) | (loop for k of-type double-float below (float nn 1.0d0) do | nil)) | | (time (tt 100000000))
Very good advice, only make sure that k and (1- k) are different, i.e., that you use fewer bits than the precision of the floating point format. (float-precision 1d0) returns that number.
Of course, this works best when double-floats are not passed around, otherwise, they need to be boxed and cons like mad. It _should_ have been equally efficient with bignums, methinks. Oh, well.
/// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.
"Ladvánszky Károly" <a...@bb.cc> writes: > I have run the following simple test both on CormanLisp and LispWorks > Personal Edition 4.2.0 and found a tremendous difference in the execution > times.
> (defun tt(nn) (dotimes (n nn) nil))
> (time (tt 100000000))
> CormanLisp:
> Total Execution time: 2.030986 seconds > Time spent garbage collecting: 0.0 seconds
> LispWorks:
> user time = 85.713 > system time = 0.140 > Elapsed time = 0:01:28 > Allocation = 1465806248 bytes standard / 19965 bytes fixlen > 0 Page faults
> What is it that makes LispWorks work that slow? > My guess was a certain compiler option could be turned on so I tried to > speed up things by > applying the following line from the listener. It made no difference.
-- Marco Antoniotti ======================================================== NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488 719 Broadway 12th Floor fax +1 - 212 - 995 4122 New York, NY 10003, USA http://bioinformatics.cat.nyu.edu "Hello New York! We'll do what we can!" Bill Murray in `Ghostbusters'.
Marco Antoniotti <marc...@cs.nyu.edu> writes: > "Ladvánszky Károly" <a...@bb.cc> writes:
> > I have run the following simple test both on CormanLisp and LispWorks > > Personal Edition 4.2.0 and found a tremendous difference in the execution > > times.
> > (defun tt(nn) (dotimes (n nn) nil))
> > (time (tt 100000000))
> > CormanLisp:
> > Total Execution time: 2.030986 seconds > > Time spent garbage collecting: 0.0 seconds
> > LispWorks:
> > user time = 85.713 > > system time = 0.140 > > Elapsed time = 0:01:28 > > Allocation = 1465806248 bytes standard / 19965 bytes fixlen > > 0 Page faults
> > What is it that makes LispWorks work that slow? > > My guess was a certain compiler option could be turned on so I tried to > > speed up things by > > applying the following line from the listener. It made no difference.
> > > I would appreciate any help on how to speed up things.
> > Cormanlisp compiles everything by default. LW does not.
> Marco,
> You should have gone to Google and read the rest of the thread. > It was fixnum sizes that made the time difference.
Sorry. I think this is a problem with my newsserver. I noticed that I get repeated articles and threads after a week or so. So the article appeared as "unread".
Who knows what's happening.
Cheers
-- Marco Antoniotti ======================================================== NYU Courant Bioinformatics Group tel. +1 - 212 - 998 3488 719 Broadway 12th Floor fax +1 - 212 - 995 4122 New York, NY 10003, USA http://bioinformatics.cat.nyu.edu "Hello New York! We'll do what we can!" Bill Murray in `Ghostbusters'.