Object-centric profiling: Advanced Visualizations to Tame Wild Program Execution Vanessa Peña, Juan Pablo Sandoval, Pablo Estefo, Alexandre Bergel Object Profile & University of Chile
2
Execution profiling with Kai Problem: Traditional code profilers are driven by the method stack, discarding the notion of sending messages Why the problem is important: How to answer to “Is there a slow function that is called too often?” Solution: An intuitive visual representation of the execution that visually compare the time spent and the number of executions 3
Execution sampling profiler 54.8 % { 11501ms } MOCanvas>>drawOn: 54.8% {11501ms} MORoot(MONode)>>displayOn: 30.9% {6485ms} MONode>>displayOn: | 18.1% {3799ms} MOEdge>>displayOn: ... | 8.4% {1763ms} MOEdge>>displayOn: | | 8.0% {1679ms} MOStraightLineShape>>display:on: | | 2.6% {546ms} FormCanvas>>line:to:width:color: ... 23.4% {4911ms} MOEdge>>displayOn: ... 4
Structural profiling blueprint legend for methods # executions (color) execution #different time receiver 5
Behavioral profiling blueprint legend for methods # executions gray = m1 m3 side effect execution m1 time invokes yellow = m2 m2 and m3 no side effect DEMO 6
Structural profiling blueprint bounds legend for methods # executions (color) execution #different time receiver 7
Behavioral profiling blueprint legend for methods # executions gray = m1 m3 side effect execution m1 time invokes yellow = m2 m2 and m3 bounds no side effect 8
Code of the bounds method MOGraphElement>>bounds "Answer the bounds of the receiver." | basicBounds | self shapeBoundsAt: self shape ifPresent: [ :b | ^ b ]. basicBounds := shape computeBoundsFor: self. self shapeBoundsAt: self shape put: basicBounds. ^ basicBounds 9
Memoizing MOGraphElement>>bounds "Answer the bounds of the receiver." | basicBounds | boundsCache ifNotNil: [ ^ boundsCache ]. self shapeBoundsAt: self shape ifPresent: [ :b | ^ b ]. basicBounds := shape computeBoundsFor: self. self shapeBoundsAt: self shape put: basicBounds. ^ boundsCache := basicBounds 10
Upgrading MOGraphElement>>bounds A B C 11
43% speedup Upgrading MOGraphElement>>bounds A B C 12
A Upgrading MOGraphElement>>bounds B 13
B C A cached absoluteBounds instead of A' C' B' C' 14
B C D A cached make display:on: absoluteBounds call absoluteBounds instead of absoluteBoundsFor: A' C' B' C' 15
B C D A cached make display:on: absoluteBounds call absoluteBounds instead of absoluteBoundsFor: A' C' B' C' 16
Test coverage with Hapao Problem: Traditional code coverage tools have a binary view of the world Why the problem is important: Which method should you test first in order to increase the coverage? Is my code well covered or not? Solution: An intuitive visual representation of a qualitative assessment of the coverage 17
Test blueprint C1 Legend for methods (inner boxes) # calling methods d # executions complexity c invocation on self C2 red = not executed blue = abstract DEMO 18
Successive improvement Version 2.2 Version 2.3 Version 2.4 Version 2.5 27.27% 54.54% 87.71% 100% 19
4 patterns 20
Moose-Test-Core.13 Moose-Test-Core.48 Moose-Core.313 Moose-Core.326 21.42% 100% 56.86% 100% 73.58% 100% 68.25% 96.66% 36.78% 64.55% 0% 100% 21
Reducing code complexity Version 1.58.1 Version 1.58.9 Coverage: 40.57% Coverage: 60.60% 22
Reducing code complexity Version 2.10 Version 2.17 23
Visualizing data with Roassal Roassal is an agile and interactive visualization engine
Visualizing Incidents at the Fire Department of NY
Supported Platforms
Multidimentional profiling thods XMLTokenizer>>nextName xecutions source code red: change black: do not change m1 ssages < than before messages > than before m2 and XMLNestedStreamReader>>atEnd m1 invokes m2 xecutions <= than before ssages > than before and xecutions > than before ssages = than before thod did not exist before
Differences between tests
Conclusion Little innovation in the tools we commonly use Profilers, debuggers, testing tools have not significantly evolved Fantastic opportunities for improvement Kai, Hapao and Roassal are just a beginning Feel free to provide feedback on our tool 30
Spy @ Cincom Store Spy @ SqueakSource Roassal @ ... ObjectProfile.com Moose-Test-Core.13 Moose-Test-Core.48 Moose-Core.313 Moose-Core.326 21.42% 100% Thanks to 56.86% 100% ESUG Chris T 73.58% 100% Cincom All of you guys! 68.25% 96.66% 36.78% 64.55% 0% 100%
Recommend
More recommend