How to investigate performance of stylers in coder
The class VirtualMachineAllProcessesSwitchTelemetry
provides a profiler that can show how much each invidual styler is taking.
In using it we should first start the telemetry for a given number of seconds and then do in that time the action that we want to profile, like opening a coder or typing in a method. A notification is raised when the telemetry is done.
telemetry := VirtualMachineAllProcessesSwitchTelemetry spyFor: 10 seconds.
telemetry eventsByProcess mergedByParentProcess
Another way to profile stylers is to manually run them several times and use a normal tally.
Two larger methods
method := BlFocusProcessorExamples>>#loseFocus_03_add_back_child_1
method := MetacelloConfigurationResource>>#setUpConfigurationOfProjectToolBox
coder := GtPharoMethodCoder forMethod: method. coderViewModel := coder asCoderViewModel.
styler := GtMethodAdviceStyler new isForWorkspace: false. styler coderViewModel: coderViewModel.
styler := GtPharoDynamicHighlightStyler new. styler coderViewModel: coderViewModel.
styler := GtPharoMethodExpanderStyler new. styler coderViewModel: coderViewModel.
styler := GtPharoDeprecationStyler new. styler coderViewModel: coderViewModel.
1000 timesRepeat: [styler style: method sourceCode asRopedText]
AndreasSystemProfiler gtSpyOn: [ 1000 timesRepeat: [styler style: method sourceCode asRopedText] ]