Haha, nope that's probably beyond the scope of what I'm trying to achieve.
 Spinoza just adds some object orientedness to struct-maps that's all.  As
far as I can tell there not much explicit control over memory consumption in
Clojure.
On Tue, Feb 3, 2009 at 2:56 PM, Bradbev <brad.beveri...@gmail.com> wrote:

>
> On Feb 1, 5:22 pm, David Nolen <dnolen.li...@gmail.com> wrote:
> > I've changed the name of my project since that was a joke anyway.
> http://github.com/swannodette/spinoza/tree/master
> >
> > Spinoza isn't just for people who want object oriented behaviors.  It's
> also
> > for anyone who plans on instantiating many structs.  Spinoza's
> make-instance
> > macro automatically orders your key/values and uses struct not
> struct-map.
> >
> > (defclass shape [object]
> >   (:position [0 0]))
> >
> > (defclass rect [shape]
> >   (:position [5 5])
> >   :width
> >   :height)
> >
> > (time (dotimes [x 1000000]
> > (make-instance rect :height 100 :width 150)))
> >
> > > ~280ms
> >
> > (defstruct rect-struct :tag :position :width :height)
> > (time (dotimes [x 1000000]
> > (struct-map rect-struct :tag ::rect :position [50 50] :width 100 :height
> > 190)))
> >
> > > ~800ms
> >
> > Also, it is now available under an MIT license, feel free to fork, send
> > patches at will etc.
>
> Does Spinoza do anything to optimize the size of the object?  I'm
> tinkering with a project that will have several million objects in
> it.  Currently I'm using struct-maps with around 7 keys, and the
> overhead appears to be around 200 bytes per map - I'd like it to be
> around 32 bytes ideally.  I'm planning on eventually using Java
> objects to shrink the size, but it would be nice if there were a
> Clojure library I could use.
>
> Cheers,
> Brad
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to