Re: Reasons to choose CLISP over other free implementations
- From: Nicolas Neuss <lastname@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 10:23:18 +0100
Juho Snellman <jsnell@xxxxxx> writes:
(The code path for the non-constant cases of MAKE-INSTANCE is very much
unoptimized in SBCL. That it has not been optimized is probably due to
few people using that case in practice. At least I've never had anyone
report MAKE-INSTANCE with non-constant class or initarg names as a
bottleneck in their program before this.)
I have been bitten by this. Maybe one year ago I profiled my PDE solver
Femlisp and found that I lose quite a lot while making small matrix
instances. My workaround in three low-level routines was the following
rewrite (?2 is a macro choosing the second argument, LRET returns the last
local variable):
(defmethod zeros (n &optional (m n) (type 'double-float))
"Returns nxn or (if m is provided) nxm zeros. The value is freshly
allocated."
(?2 (make-instance (standard-matrix type) :nrows n :ncols m)
;; this branch avoids calling make-instance with keyword arguments on
;; a class unknown at compile time, because this is a performance
;; problem for several CL implementations
(lret ((result (make-instance (standard-matrix type))))
(with-slots (store nrows ncols) result
(setf nrows n ncols m
store (make-array (* n m) :element-type type
:initial-element (coerce 0 type)))))))
Yours,
Nicolas
.
- Follow-Ups:
- Re: Reasons to choose CLISP over other free implementations
- From: Pascal Costanza
- Re: Reasons to choose CLISP over other free implementations
- References:
- Reasons to choose CLISP over other free implementations
- From: Javier
- Re: Reasons to choose CLISP over other free implementations
- From: Geoff Wozniak
- Re: Reasons to choose CLISP over other free implementations
- From: Javier
- Re: Reasons to choose CLISP over other free implementations
- From: Juho Snellman
- Re: Reasons to choose CLISP over other free implementations
- From: Javier
- Re: Reasons to choose CLISP over other free implementations
- From: Juho Snellman
- Reasons to choose CLISP over other free implementations
- Prev by Date: Re: The origins of CL conditions system
- Next by Date: Re: Reasons to choose CLISP over other free implementations
- Previous by thread: Re: Reasons to choose CLISP over other free implementations
- Next by thread: Re: Reasons to choose CLISP over other free implementations
- Index(es):