1944 methods

Pavel Krivanek squeak1 at continentalbrno.cz
Wed Jun 13 20:01:52 UTC 2007


Hi all,

I have played with a very simple, extremely slow but powerful shrinking method:
- take some very small image
- create a task you want to do, for example some basic script like

(FileStream forceNewFileNamed: 'out.txt') nextPutAll: (Compiler
evaluate: '3+4') asString; close.
SmalltalkImage current snapshot: true andQuit: false.

- define the correct outputs (the file out.txt includes the text '7')
- create a control image (with OSProcess) that takes the small image
and starts to remove method by method and tests if the resultant image
is not broken and returns correct outputs ;-)
- the result is an image with the minimal possible count of methods
for this task

Of course it isn't so simple in real but this is the basic principle.
I got the result 1944 methods the Squeak 3.10 (Squeak 2.2 mini image
has more than 4000 methods).  The image and the lists of methods can
be downloaded here:
http://comtalk.net/public/tmp/shrink20070513.zip

For example the only Methods for UndefinedObject are
UndefinedObject >> notNil
UndefinedObject >> handleSignal:
UndefinedObject >> isEmptyOrNil
UndefinedObject >> isNil

If you're expecting extremely small image with few kilobytes, I have
to  disappoint you - the image has about 1,2 MB. That's because it
includes lot of the other garbage. The main purpose is to show the
Squeak code base.

In fact the image can do much more than evaluate the script - it can
shrink yourself to this size and test if the methods were removed
properly. It can write the number of instances of a class etc. Some
methods are redundant because I included it during shrinking manually.

Of course it removed the platform specific code that it doesn't need
so I expect that it will be runnable only on Linux.

Maybe it opens the new interesting way how to continue with the
license change. Only very few people can help with the license audit
but all have computers and somebody may have access to powerful
clusters.

If the output conditions will be: "file-in the removed code back and
perform basic tests", we may get relatively small set of methods for
the license conversion. So we can have small MIT kernel and the rest
of "non-free" Squeak code can be downloaded and loaded  manually by
users.

Cheers,
-- Pavel



More information about the Squeak-dev mailing list