Last updated at 11:27 am UTC on 7 April 2006
The TimeProfileBrowser is a performance profiling browser in Squeak, based on the core MessageTally tool. (The output of the TimeProfileBrowser tool and the MessageTally tool is the same, the only difference is that the TimeProfileBrowser lets you conveniently browse the methods in the profile.)
If a specific operation in Squeak seems too slow, use the TimeProfileBrowser to find out why:
[ 20 timesRepeat: [ Transcript show: 100 factorial printString ]].
Or whatever you want to do in the block. You'll see a breakdown by percent of time spent. Attack the parts that are taking the most time, if you want to speed it up.
Or, if the operation happens to be a UI operation:
Let's say that the slow operation is the act of closing a particular window in Morphic. You can start up a MessageTally/TimeProfileBrowser by using the "debug..."/"start/browse MessageTally" menu item. It will warn you that it is about to start the tally. After starting it, immediately do the operation (close the particular window in this case), and then quickly move your mouse to the top of the screen to end the tally. A window will now appear with the tally results, which is a hierarchy of the methods in which a significant amount of time is spent. Probably a significant chunk of the time (maybe more than 50%) is spent in the method WorldState>>interCyclePause:... this is the extra time that was spent before and after closing the window, which we can ignore. We can follow the other branch (HandMorph>>handleEvent:, etc.) down and see what the "deepest" method(s) are which are still taking a significant percentage of time, and browse the code to see if there's an obvious problem in the implementation.
Q: I don't like the way the Tally results are shifted back to the left with the "[" when the stack gets 18 methods deep. Is there a way to fix this?
A: Yes, edit the method MessageTally class>defaultMaxTabs and change the value from 18 to a larger number such as 60.
See also Squeak Performance Tuning.