3. 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
6. Behavioral profiling blueprint
legend for methods
# executions
gray =
side m1 m3
execution effect m1
time invokes
yellow = m2 m2 and m3
no side
effect
DEMO 6
8. Behavioral profiling blueprint
legend for methods
# executions
gray =
side m1 m3
execution effect m1
time invokes
yellow = m2 m2 and m3
bounds no side
effect
8
9. 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
14. B C
A
cached
make
absoluteBounds
call abs
instead of ab
A'
C'
B'
C'
14
15. B C
A D
cached
make display:on:
absoluteBounds
call absoluteBounds
instead of absoluteBoundsFor:
A'
C'
B'
C'
15
16. B C
A D
cached
make display:on:
absoluteBounds
call absoluteBounds
instead of absoluteBoundsFor:
A'
C'
B'
C'
16
17. 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
18. Test blueprint
C1
Legend for methods (inner boxes)
# calling methods
d complexity # executions
c
invocation on self
C2 red = not executed
blue = abstract
DEMO 18
28. Multidimentional profiling
r methods
XMLTokenizer>>nextName
r of executions
source code
node red: change
color black: do not change
m1
# messages < than before
# messages > than before m2
and
m1 invokes m2 XMLNestedStreamReader>>atEnd
# executions <= than before
# messages > than before
and
# executions > than before
# messages = than before
his method did not exist before
30. 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
31. 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%
36.78%
96.66%
64.55%
0% 100%