Raymond Toy | 13 Mar 04:47 2012

Re: How expensive is CLOS object creation ?

On 3/12/12 10:18 AM, Akshay Srinivasan wrote:
> Hi,
> 	Now that I have a reasonable amount of support for matrix slices (and
> more). I can now do neat stuff like
> ? (defvar a (make-complex-matrix 2 2))
> ;; Get the second column
> ? (defvar e (make-sub-matrix a 0 1 2 1))
> ;; Set the imaginary part of the second column to pi
> ? (copy! pi (imagpart! e))

This is pretty cool stuff!
> without without ever having to copy the store. I guess this is okay
> for user interaction; but I guess there are costs involved with
> creating new CLOS objects though. Should this sort of stuff be avoided
> inside core functions then ?

I think it really depends on the clos implementation.  I would say for
now to just ignore it unless you're creating lots of clos objects in a
tight loop.  That's probably not a good idea, plus that generates a lot
of garbage.


> Akshay
> P.S: I will merge my changes and push things to matlisp-cffi, after
> sending this mail.

Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!