Travis posed an interesting thought: within a body of code, which methods get sent most often? He used this little code snippet to find out:
bag := Bag new.
bundle := Store.Registry bundleNamed: 'BottomFeeder'.
bundle leafItems do:
[:pkg |
pkg compiledMethods do:
[:each | each resourceType ifNil: [each messagesDo: [:selector | bag add: selector]]]].
sorted := bag contents associations sorted: [:a :b | a value > b value].
He then did it again using a multiplier for message length. Curious, I tried that out on the BottomFeeder bundle, and discovered that I mostly send core system messages:
| isNil | 691 |
| new | 685 |
| add: | 503 |
| nextPutAll: | 496 |
| , | 496 |
| << | 488 |
| >> | 488 |
| -> | 361 |
| notNil | 308 |
| settings | 308 |
I see that I do a fair amount of comparisons in there - applying the multiplier::
| nextPutAll: | 5456 |
| isNil | 3455 |
| settings | 2464 |
| asString | 2144 |
| new | 2055 |
| add: | 2012 |
| notNil | 1848 |
| printString | 1639 |
| at:put: | 1582 |
| replaceFrom:to:with:startingAt: | 1581 |
I guess I create a lot of new objects, and work with a lot of streams :)