Hi Mariano,

Great to see further progress on this! I'll take a closer look at your script 
this evening. But what I wonder is why PharoCore 1.1 is so big and you only get 
down to 9MB (is this the size on disk?)?

In a PharoCore 1.0 running #cleanUpForRelease, #cleanUpForProduction, deleting 
the class ScriptLoader and all changesets I get an image that is 8.1MB on disk. 

Cheers,
Adrian


On Mar 23, 2010, at 10:15 , Mariano Martinez Peck wrote:

> Hi folks. I was playing a bit trying to shrink a little a PharoCore image.
> My idea was to think a shrink that was be acceptable for the most common
> scenario: a runtime (production) environment where. Of course, some of the
> things I do in the shrinks has side effects, but most of the times, you can
> deal with that in such scenarios.
> 
> Some of the things came from my mind, others from an OLD version of
> SystemDictionary >> majorShrink, others from Pavel's PharoKernel, etc.
> 
> So...I will post the little code here. I am not completely sure about the
> side effects of each piece, so if you know, please let me know :)
> 
> On the other hand, I wanted to ask you if you think something of this make
> sense to be part of ScriptLoader >> cleanUpForProduction
> 
> Taking a PharoCore 1.1  11277  of 13 MB   I get an image of 9 MB...so 4 MB
> less and I can still even browse code.
> When running the image before the shrink I get 25MB in use and with the
> image shrinked I get 20MB.
> 
> Cheers
> 
> Mariano
> 
> 
> 
> 
> 
> "Compact all MethodDictionary instances"
> 
> | oldInstances newInstances |
> oldInstances := MethodDictionary allInstances.
> newInstances := oldInstances collect:
>                    [ :md |
>                        (MethodDictionary new: md size)
>                            compactCopyFrom: md;
>                            yourself].
> 
> oldInstances elementsForwardIdentityTo: newInstances.
> 
> 
> 
> "To put all all classes with the default category. Still can browse and
> recompile the whole image.
> Most production enviroments don't care about categories...this make sense
> when developing."
> 
> Smalltalk allClassesAndTraitsDo: [:each | each zapOrganization ].
> 
> 
> "Different cleanUps"
> 
> TextStyle
>        allSubInstancesDo: [:ts | ts
>                newFontArray: (ts fontArray
>                        copyFrom: 1
>                        to: (2 min: ts fontArray size))].
> 
> "Clean all Monticello related stuff. You won't be able to browse packages
> for example"
> 
> MCWorkingCopyBrowser allInstancesDo: [:each | each flushAllCaches ].
> MCWorkingCopy allInstancesDo:[:wc| SystemChangeNotifier uniqueInstance
> noMoreNotificationsFor: wc. wc unregister].
> SystemChangeNotifier uniqueInstance noMoreNotificationsFor:
> MCPackageManager.
> SystemChangeNotifier uniqueInstance noMoreNotificationsFor: MCWorkingCopy.
> 
> "Most application don't need sound"
> 
> SoundService default: nil.
> SoundService unregister: DummySoundSystem.
> 
> SystemChangeNotifier uniqueInstance noMoreNotificationsFor: (Smalltalk at:
> #RecentMessageSet).
> 
> TranscriptStream newTranscript: ThreadSafeTranscript new.
> 
> ImageSegment classPool at: #RecentlyRenamedClasses put: Dictionary new.
> ExternalSettings classPool at: #RegisteredClients put: Set new.
> 
> Locale classPool at: #LocaleChangeListeners put: nil.
> 
> "Clean all the changes"
> 
> ChangeSet resetCurrentToNewUnnamedChangeSet.
> ChangeSet current initialize.
>    ChangeSet classPool
>        at: #AllChangeSets
>        put: (OrderedCollection with: ChangeSet current).
> 
> Symbol rehash.
> 
> 3 timesRepeat: [ Smalltalk garbageCollect. Symbol compactSymbolTable ].
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to