On Oct 12, 2008, at 12:52 , Stéphane Ducasse wrote:

this is strange that certain strings are repeated 3 times.

Flaps are like drawers
This tool allows you
SUnit removing...

hm..
we can find out by looking where they are referenced. If you open an inspector and close all other windows that may potentially have a reference to the string, and then in the context menu: Chase pointers. This shows you at the bottom where the object is referenced.

One of the largest strings is a literal in ISOLanguageDefinition class>>iso3166Codes (almost 1k).

Adrian


Stef
On Oct 12, 2008, at 12:22 PM, Alexandre Bergel wrote:

Excellent Adrian.

For String, a similar expression does it:
ByteString allInstances asSortedCollection: [ :e1 :e2 | e1 size >= e2 size ]

        ByteString allInstances inject: 0 into: [:sum :el | sum + el size]
The total amount of strings is   1,533,483 bytes

Interesting:
        (ByteString allInstances select: [:s | s = '']) size ==> 601

Cheers,
Alexandre


On 11 Oct 2008, at 21:20, Stéphane Ducasse wrote:

excellent!
I would be also curious about the size of the strings.
And yes
- we need to have a cleanup process as proposed/examplified by keith

For the default fonts: do we have a process to reload the non default fonts?

Stef

On Oct 11, 2008, at 8:11 PM, Adrian Lienhard wrote:

I've been looking into how the current 13.4MB a Pharo image uses are spent... I expected that at least half of it is used by classes (compiled methods). But this is not the case. Actually, only about 1/4th are classes. As it turned out, almost the same amount of memory is used by forms (actually bitmaps)!

If you want to know which are the largest 10 forms try this:

(Form allInstances asSortedCollection: [ :e1 :e2 | e1 bits size >= e2 bits size ]) from: 1 to: 10 do: [ :each | each asMorph openInWorld ]

...among which for example are 4 different color pickers. In total there are around 450 forms, most from EToys. I've manually traced down where the larger forms come from and have cleaned up those that were possible (many are only referenced by caches). The number of forms is at 320 now.

In the process I produced the script below, which among other stuff removes all but the default font. Also, it actually removes the flaps from the system instead of only hiding them. Here a history of image sizes:

Squeak  3.9: 15.6 MB
Pharo 10091: 13.4MB (before cleanup)
Pharo 10091: 10.9MB (after cleanup)

Main conclusion: the system needs cleanup not only of the code (where the mess is more directly visible), but also of the object memory. Furthermore, I expect removing EToys will have an nice impact on the image size. Also removing Sound will release some memory because of sound samples.

If anybody has suggestions to further reduce the image size (<10MB would be a nice target for the first release...), please let me know.

Cheers,
Adrian



Preferences setDefaultFonts: #(
        (setSystemFontTo: 'Accuny' 10)
        (setListFontTo: 'Accuny' 10)
        (setMenuFontTo: 'Accuny' 10)
        (setFlapsFontTo: 'Accuny' 12)
        (setEToysFontTo: 'Accuny' 10)
        (setPaintBoxButtonFontTo: 'Accuny' 10)
        (setWindowTitleFontTo: 'Accuny' 15)
        (setBalloonHelpFontTo: 'Accuny' 10)
        (setCodeFontTo: 'Accuny' 10)
        (setButtonFontTo: 'Accuny' 8)).
TextConstants associations do: [ :association |
        ((association value isKindOf: TextStyle)
                and: [ association key ~= #Accuny ]
and: [ (TextStyle defaultFamilyNames includes: association key) not ])
                ifTrue: [ TextConstants removeKey: association key ]].
TextConstants at: #DefaultFixedTextStyle put: (TextConstants at: #Accuny).

(Flaps classPool at: #SharedFlapTabs) removeAllSuchThat: [ :each | (#(Tools Pharo) includes: each labelString) not ]. NaturalLanguageFormTranslator classPool at: #CachedTranslations put: nil.
NaturalLanguageTranslator resetCaches.
PartsBin clearThumbnailCache.
PaintBoxMorph initialize.
PaintBoxMorph classPool at: #ColorChart put: nil; at: #Prototype put: nil.
Utilities classPool at: #ScrapsBook put: nil.
Project allInstancesDo: [ :each | each setThumbnail: nil ].
InternalThreadNavigationMorph clearThumbnailCache.
ScriptingSystem stripGraphicsForExternalRelease.
ProjectHistory currentHistory initialize.
Utilities zapUpdateDownloader.
Smalltalk forgetDoIts.
Behavior flushObsoleteSubclasses.
CommandHistory allInstancesDo: #initialize.
ScriptLoader new cleaningCS.
RequiredSelectors initialize.
ProvidedSelectors initialize.
LocalSends initialize.
SendCaches initializeAllInstances.
Utilities cleanseOtherworldlySteppers.
Smalltalk organization removeEmptyCategories.
SystemBrowser removeObsolete.
TheWorldMenu removeObsolete.
AppRegistry removeObsolete.
FileServices removeObsolete.
SystemNavigation default obsoleteBehaviors.
MCFileBasedRepository flushAllCaches.
MCDefinition clearInstances.
Undeclared removeUnreferencedKeys.
Smalltalk flushClassNameCache.
3 timesRepeat: [ Smalltalk garbageCollect. Symbol compactSymbolTable ].
Set rehashAllSets.
Smalltalk garbageCollect.


___________________
http://www.adrian-lienhard.ch/

_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project



_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to