[etoys-dev] Redundant strings in image

Bert Freudenberg bert at freudenbergs.de
Sun May 2 14:15:17 EDT 2010


On 02.05.2010, at 18:45, Bert Freudenberg wrote:
> It's astonishing to me how many copies we have of some strings in the new dev image. They add up to more than 3 MB wasted space! See for yourself:
> 
> =====================
> | f strings sorted count wasted |
> strings := Bag new.
> String allSubInstances
> 	do: [:s | strings add: s]
> 	displayingProgress: 'counting ...'.
> sorted := SortedCollection sortBlock: [:a :b | a first >= b first].
> wasted := 0.
> strings asSet asArray
> 	do: [:s |
> 		count := strings occurrencesOf: s.
> 		count > 1 ifTrue: [
> 			wasted := wasted + (count - 1 * s byteSize).
> 			sorted add: {count*s byteSize. count. s}]]
> 	 displayingProgress: 'sorting ...'.
> f := FileStream newFileNamed: 'bla.txt'.
> [sorted do: [:each |
> 		f nextPutAll: '==============='; cr.
> 		each do: [:elem | f nextPutAll: elem asString]
> 			separatedBy: [f space].
> 		f cr]
> 	displayingProgress: 'writing ...'.
> ] ensure: [f close].
> wasted asStringWithCommas
> =====================
> 
> In comparison, the Etoys 4.0 release image had "only" 600 KB wasted by this.
> 
> Any idea where those strings could come from?
> 
> - Bert -

Sorry, false alarm. In a clean dev image it's also about 600 KB. So not worse than before. Still, there are some very strange strings in the image.

Ah, I found a big pile: If I empty the InternalTranslator's caches and translations, the image shrinks by 1.5 MB! Any reason not to do this? I don't think we need the InternalTranslator any more.

- Bert -




More information about the etoys-dev mailing list