Hi
Henrik Gedenryd answered to my question 20 days ago:
There will be a grat deal of refactoring required before the module
system
will work to shrink the image efficiently. Even with the module system,
all
the horrible dependencies are still there and need to be removed.
So it will be a while before the old-style shrinking procedure will be superseded.
and yesterday he wrote
But what I really wonder is what made the image grow to 15+ megs from 9
or
so, it's nowhere near all code, I thought it was the "Welcome" projects
but
that's just roughly a meg. It's really terrible that shrinking the image
is
the blackest of Squeak arts.
I did a test today how to reduce the image size of a Squeak3.3a-4664.image which is 16446kB.
I did the following steps
Select 'flaps...' and then 'destroy shard flaps'. Manually delete the sample projects. Execute
Smalltalk zapAllOtherProjects
This reduced the image size to 15326KB.
Executing ChangeSet allInstancesDo: [:cs | cs zapHistory]. Smalltalk garbageCollect and saving the image showed that a new image size of 11839kB
Deleting all the ChangeSets ChangeSorter removeChangeSetsNamedSuchThat: [:aName | (aName = 'New Changes') not]
gave a new image size of 10170kB which is a total reduction of 38%.
So the major part comes from the change sets not the example projects.
I did a similar test some last week with a 4599 image and documented it on http://minnow.cc.gatech.edu/squeak/2182 (Smalltalk majorShrink)
It gave a 50% reduction and I still had a running system which was fairly complete (for my needs).
The page http://minnow.cc.gatech.edu/squeak/2182 contains copies from emails I collected from this list.
Another test (not documented there) gave a resulting image (with Morphic) with just 4.5 MB which was fine.
The basic conclusion is that you have to do your own version of "Smalltalk majorShrink".
I hope this information helps.
Hannes Hirzel
P.S. Thank you, Henrik, for your work on modules! It's nice that it's now in the update stream.
Hannes Hirzel wrote:
I hope this information helps.
Hannes Hirzel
Thanks! Yes it did. I should have thought of the change sets myself.
The basic conclusion is that you have to do your own version of "Smalltalk majorShrink".
Well, a submenu for world menu/help/shrinking the image, with these commands as menu items, and good balloon help, would go a long way. (Module unloading will handle the code stripping part.) And perhaps an item putting up a window with some instructive help text. Much like some of the text on your swiki page.
I'd strongly vote it for inclusion ;-)
And
ChangeSorter removeChangeSetsNamedSuchThat: [:aName | (aName = Smalltalk changes name) not]
is slightly more general, Smalltalk changes is the active cs.
Methods of the Smalltalk object (an instance of SystemDictionary which discard code:
SystemDictionary selectors asSortedCollection do: [:s | (s asString beginsWith: 'discard') ifTrue: [Transcript show: s printString; cr]].
gives
#discard3D
Type 'discard', select it, do cmd-W. (Browse all selectors that include 'discard')
Quite a bit easier...
Henrik
squeak-dev@lists.squeakfoundation.org