Friday, September 7, 2012

Hello TinyCLOS

A couple of days ago, in edelib tree
landed TinyCLOS, a CLOS-like object system for Scheme. I
used original implementation and thanks to it's excellent design, I had to
change only a couple of lines of code to adapt it.

The main reason for adding it was to stress Scheme interpreter with some serious code so it placed inside edelib test suite and is not installed with the rest of the library.

Truth to be told, I was surprised when TinyCLOS loaded for the
first time. Within first runs, I manage to detect a few nasty bugs: two in
Scheme functions (append and reverse) and one in interpreter
garbage collector. Everything was corner case so ordinary code used by EDE would
probably not catch it, but who knows.

Another surprise is startup time: loading TinyCLOS is dog slow and
with a couple of tests, it will require almost 10 seconds to complete
where around 7-8 seconds will be reserved for library load. That is brutal!

I haven't had enough time to look deeply what the cause is, but one of
the reasons could be eager creation of primitive class objects
(<class>, <boolean> and so on); the second reason is
definitely a large number of GC calls. In both cases things can be
improved, which I marked as TODO for upcoming time.