Of course it might be the case that not many people are interested in the
implementing ideas from CLOS for Clojure especially since there's a lot of
exciting new functional ground to cover in Clojure first ;)  I come from a
UI background so I'm interested in the OO implications/possiblities of
Clojure.
In any case a couple half-thought out notes about make-instance performance
characteristics:
make-instance is about as fast as struct-map even tho it dynamically looks
up key initializers (make sense since it's just a macro that unfolds into a
struct-map).

On a new MBP 2.4ghz you can allocate 1,000,000 instances (3 fields) in
~700ms.  Same for struct-map.  struct is a little less than 4 times faster
it seems that struct-map. One possible optimization for make-instance would
be to make make-instance automatically order all keys (seems like a bit of
work especially with multiple inheritance).  As a comparison using a
hash-map directly gives another 3-4x performance increase.

As a comparison of other implementations (probably not a fair one since CLOS
does way more bookkeeping than my measly hack ;):

SBCL instantiates 1,000,000 instances of a class with 3 fields in ~70ms
(could get closer to ~250ms in Clojure with auto-ordering of keys, if the
sorting algorithm was quick enough).
Clozure CL 64 does the same in ~1.5secs.

Cool stuff.  Clojure is zippy.

--~--~---------~--~----~------------~-------~--~----~
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