Saturday, August 16, 2008

Profiling Joose bootstrap time

Joose is self-hosting which means two things:
  1. Most parts of the Joose framework are written using Joose itself
  2. Those parts of the framework where this is not possible (the most fundamental parts) are later bootstrapped to look like the had been written using Joose
The nice thing about this is that all objects within the Joose object system are introspectable using Joose's own methods. It is in a sense pure.
However, bootstrapping incurs overhead (because you do stuff) and I was wondering how big the overhead is. Well, it turns out it is rather small.

I used firebug for profiling, so all my numbers are from Firefox. My computer is a Macbook Pro with 2.5 GHz Core 2 Duo.

Under Firefox 3 compiling Joose takes 17 milliseconds and under Firefox 2 the compilation takes 23 milliseconds, so we are around 2 hundreds of a seconds. Real speed junkies might be worried about this, but tricks like compiling all JS files into one large file probably make a much larger difference.

My conclusion is that Joose's overhead is pretty much negligible, but obviously you have to judge yourself. If anybody is really worried about the 20 milliseconds (maybe because it turns out to be 6000 milliseconds under IE6 :) there is a possible optimization to reduce the bootstrap time to 0, but I won't do it until it is absolutely neccessary.

No comments: