The Great Startup Problem
mroos at roos.com
Sun Aug 24 21:10:47 UTC 2014
In answer to Charles question on what others do to help the startup.
Smalltalk is like Ruby in that we always start from source code. In our
there are a few hundred classes and a few thousand methods that would
be considered minimal ( we call these the base ) and around a thousand
classes and 30000 methods which comprise the Smalltalk libraries. We
then add two thousand classes and 40000 methods for our app. As
Charles mentioned most of these are never used in a typical session so
we need some way to not load them all.
So what we do is precompile all of the base into a simplified byte code
which is quick to translate to jvm byte codes. Our loader then simply
reads the source files and builds the object structures for the classes
and methods. This goes pretty fast. We then do the method translation
only when a method is invoked and then cache that result. If the method
was not base then it needs to be created from the source. Again this is
done on demand.
Why not precompile all methods? Well at some point we probably will. But
for now it allows more flexibility as we change the implementation.
It is slow to compile from source to jvm vs executing the jvm ( almost
30X) but we only do it for used methods and only once so its not so bad.
Unless you happen to be looking at the profiler output.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mlvm-dev