言語ゲーム

とあるエンジニアが嘘ばかり書く日記

Twitter: @propella

Squeak のメモリを追え!

目的: Squeak のイメージサイズを出来るだけ小さくする。

サイズの大きいインスタンスを持つクラスをリストアップする。

01-19 版 (inst space でソートした上位10)
                                code space # instances  inst space percent
Array                                 2098       86096       4169396    16.6
String                                5513       84868       4086863    16.2
ByteArray                             3571         499       3576306    14.2
CompiledMethod                       10695       51271       3235974    12.9
Bitmap                                3618         716       1967972     7.8
Association                            647       84916       1018992     4.1
Symbol                                3746       39047        967194     3.8
MethodChangeRecord                     406       39561        791220     3.1
ClassChangeRecord                     2852       11776        753664     3.0

03-02 版 (inst space でソートした上位10)
                                code space # instances  inst space percent
Array                                 2098       88202       4977324    18.7
ByteArray                             3571         511       4156826    15.7
String                                5513       86036       4155355    15.6
CompiledMethod                       10695       51565       3268377    12.3
Bitmap                                3618         651       1949428     7.3
Association                            647       86521       1038252     3.9
Symbol                                3746       39081        968205     3.6
MethodChangeRecord                     406       39813        796260     3.0
ClassChangeRecord                     2852       11964        765696     2.9

Array インスタンスのサイズに着目した特徴の抽出

(Array allInstances select: [:each | each size > 1000]) size   01-19 111   / 03-02 112
(Array allInstances select: [:each | each size < 1000]) size   01-19 86268 / 03-02 88305
(Array allInstances select: [:each | each size < 100]) size    01-19 85730 / 03-02 85788
(Array allInstances select: [:each | each size < 10]) size     01-19 71436 / 03-02 71580
(Array allInstances select: [:each | each size < 5]) size      01-19 50522 / 03-02 50228

(Array allInstances select: [:each | each size = 100]) size    01-19 1     / 03-02 1966

特に、インスタンス100 の変化が顕著である。

((Array allInstances select: [:each | each size = 100]) last: 100)
	 collect: [:each | (Smalltalk pointersTo: each) first class].
#(SparseLargeTable SparseLargeTable SparseLargeTable ...

大体は SparseLargeTable の要素である。

現象としては、BorisFixesJan18 を入れるとサイズが大きくなる。01-19 までは BorisFixesJan18 はフォントをインストール後手で file in していた為、出現しなかった。特に、このチェンジセットに含まれる StrikeFont >> postCopy が原因である事が判明した。