4. Micro vs Macro Benchmarking
Micro
✘ Repeatable measurement of specific
sections of code
✘ Abstracted from virtual machine
warmup, garbage collections
and other side effects
5. Micro vs Macro Benchmarking
Micro
✘ Repeatable measurement of specific
sections of code
✘ Abstracted from virtual machine
warmup, garbage collections
and other side effects
Macro
✘ Repeatable measurement of whole
application or it’s part performance
from user point of view
✘ Abstracted from performance
overhead caused by monitoring
tools
27. What to consider before optimization?
Operation system
Windows, Linux, MacOS
28. What to consider before optimization?
Operation system
Windows, Linux, MacOS
Runtime type
CLR, Core CLR, Mono
29. What to consider before optimization?
Operation system
Windows, Linux, MacOS
Runtime type
CLR, Core CLR, Mono
Configuration
X86 or x64
30. What to consider before optimization?
Operation system
Windows, Linux, MacOS
Runtime type
CLR, Core CLR, Mono
Garbage collector type
GC, Boehm, Sgen
Configuration
X86 or x64
36. What to read before?
✘ “Writing High-Performance .NET Code” by Ben Watson
✘ “Under the Hood of .NET Memory Management” by Chris Farrell and
Nick Harrison
✘ “Detecting and Solving Memory Problems in .NET” by Alexey Totin
✘ Jetbrains official documentation
✘ Pluralsight course - “.NET Performance Optimization and Profiling
with JetBrains dotTrace” by Xavier Morera
47. What tools are available?
Macro
✘ Visual Studio Profiling Tools
✘ “dotTrace” and “dotMemory”
from Jetbrains
✘ “ANTS Memory Profiler” from
Redgate
✘ “YourKit”
✘ Old good “Xperf” and
“PerfMon”
48. What tools are available?
Macro
✘ Visual Studio Profiling Tools
✘ “dotTrace” and “dotMemory”
from Jetbrains
✘ “ANTS Memory Profiler” from
Redgate
✘ “YourKit”
✘ Old good “Xperf” and
“PerfMon”
Micro
✘ “BenchmarkDotNet”
✘ ???
52. dotTrace features
✘ Performance profiling with various levels of details
✘ Hotspots and bottlenecks detection
✘ Threads Timeline
53. dotTrace features
✘ Performance profiling with various levels of details
✘ Hotspots and bottlenecks detection
✘ Threads Timeline
✘ Performance gain forecasting
54. dotTrace features
✘ Performance profiling with various levels of details
✘ Hotspots and bottlenecks detection
✘ Threads Timeline
✘ Performance gain forecasting
✘ Remote profiling
55. dotTrace features
✘ Performance profiling with various levels of details
✘ Hotspots and bottlenecks detection
✘ Threads Timeline
✘ Performance gain forecasting
✘ Remote profiling
✘ Unit tests profiling
58. dotMemory features
✘ Shows all allocated objects consumed be the app
✘ Shows current state of Finalization Queue
59. dotMemory features
✘ Shows all allocated objects consumed be the app
✘ Shows current state of Finalization Queue
✘ Shows how effectively collections are utilized
60. dotMemory features
✘ Shows all allocated objects consumed be the app
✘ Shows current state of Finalization Queue
✘ Shows how effectively collections are utilized
✘ Shows memory leaks
61. Out of profiling scope
✘ UI client side
✘ Database interactions
✘ Network and infrastructure communications
✘ Native Apps (iOS, Android)
64. Conclusion
✘ You can get answers to…
○ Why this s**t is working slowly?
○ Why this s**t is so hungry?
65. Conclusion
✘ You can get answers to…
○ Why this soft is working slowly?
○ Why this soft is so hungry?
66. Conclusion
✘ You can get answers to…
○ Why this soft is working slowly?
○ Why this soft is so hungry?
✘ More descriptive Technical debt items
67. Conclusion
✘ You can get answers to…
○ Why this soft is working slowly?
○ Why this soft is so hungry?
✘ More descriptive Technical debt items
✘ Ability to forecast performance gains
68. Conclusion
✘ You can get answers to…
○ Why this soft is working slowly?
○ Why this soft is so hungry?
✘ More descriptive Technical debt items
✘ Ability to forecast performance gains
✘ Can understand how dependent your project from 3-rd party
components
69. Conclusion
✘ You can get answers to…
○ Why this soft is working slowly?
○ Why this soft is so hungry?
✘ More descriptive Technical debt items
✘ Ability to forecast performance gains
✘ Can understand how dependent your project from 3-rd party
components
✘ Can create performance trend