SlideShare a Scribd company logo
Instrumentation &
the Pitfalls of
Abstraction
ESUG - 2023 - Lyon
* Supported by AlaMVic Action Exploratoire INRIA
guillermo.polito@inria.fr
@guillep
Evref
fervE
1
Generated by DALL-E
First: About Me
2
Evref
fervE
• Keywords: compilers, testing, test generation
• Ph.D.: Re
fl
ection, debloating, dynamic updates
• Interests: tooling, benchmarking, 日本語, board games, concurrency
Talk to me!
Or: guillermo.polito@inria.fr
guillermo.polito@inria.fr
@guillep
Building Dynamic Analyses
• Dynamic call graphs
• Code coverage
• Pro
fi
lers
• Time
• Number of calls
3
Method Wrappers, Objects as Methods
4
Remember Method Lookup
sender receiver
class
s1
s2
…
s4
…
m1
m2
m3
s2
superclass
s1 …
s5 …
inherits from
instance of
reference
message
5
sender receiver
class
s1
s2
…
s4
…
m1
m3
s2
superclass
s1 …
s5 …
Objects as methods
o1
inherits from
instance of
reference
message
6
sender receiver
class
s1
s2
…
s4
…
m1
m3
s2
superclass
s1 …
s5 …
Objects as methods + run:with:in:
o1
run:with:in:
inherits from
instance of
reference
message
7
How far can we get with
run:with:in: ?
8
A First Method Proxy
run: aSelector with: anArrayOfObjects in: aReceiver
| result |
self logBefore: aSelector.
result := self
forwardMethod: originalMethod
withReceiver: aReceiver
withArguments: anArrayOfObjects.
self logAfter: aSelector.
^ result
9
Let’s instrument factorial
doit 17
px
log:
fwd…
factorial
run:with:in:
10
doit 17
Let’s instrument factorial
px
log:
fwd…
run:with:in:
factorial
11
Let’s instrument factorial
doit 17
px
log:
fwd…
run:with:in:
factorial
16
factorial
…
12
Let’s instrument factorial
doit 17
px
log:
fwd…
run:with:in:
factorial
16
px
log:
fwd…
run:with:in:
factorial
…
13
Let’s get a bit more hardcore
14
doit
aSet
add:
px
run:with:in: log:
Instrumenting Set>>#add:
15
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
Instrumenting Set>>#add:
16
Instrumenting Set>>#add:
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
run:with:in:
17
Meta-Recursions
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
run:with:in:
• The instrumentation gets instrumented!
• And, with more complex
instrumentation, more di
ffi
cult to debug
• The burden: on the developer
18
Solving Meta-Recursions
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
19
Solving Meta-Recursions
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
Instrumentation zone
20
Solving Meta-Recursions
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
Instrumentation zone
21
And That’s not All
• Stack unwind (non-local returns, exceptions) pass around the logAfter:
• Concurrent access to our instrumentation zone?
• lose logs
• break the instrumentation
• Maybe we can do some concessions: e.g., do not proxy the proxy…
This burden, is on the developer
22
The Cost of Missing Abstraction
• The language gives us only low-level instrumentation hooks
• #run:with:in:
• #doesNotUnderstand:
• #cannotInterpret:
• i.e., they are at the wrong level of abstraction for proper instrumentation
Covering the GAP, is on the developer
23
The Proxy We Have
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
Instrumentation zone
24
The Stratified Proxy We Want
doit
aSet
add:
px
run:with:in: log:
otherSet
add:
Instrumentation zone
handler
before:
after:
Infrastructure
• Meta-recursion
• Concurrency
User concern
• logging?
• analysis?
25
Stratified Proxies
26
Safe Method Proxies + Exact Method Profiler
• Method Proxies: https://github.com/pharo-contributions/MethodProxies
• Method Pro
fi
ler: https://github.com/pharo-contributions/MethodPro
fi
ler
• + common instrumentation layer between proxies and meta-links !
27
Let’s get a bit more hardcore
again
28
Let’s Instrument the Compiler
prf := PrfMethodProfiler new.
prf addPackage: OpalCompiler package.
prf addPackage: RBParser package.
prf profile: [ Integer recompile ].
29
prf := PrfMethodProfiler new.
Instrumentation & the Pitfalls of Abstraction
^ self < 2
ifTrue: [1]
ifFalse: [
(self-1) benchFib + (self-2) benchFib + 1]
Let’s Benchmark with Fibonacci
• Best case for proxy infrastructure
• no exceptions
• no non-local return
• no meta-recursion
• no concurrent usages by default
fi
b n - 1
fi
b n - 2
fi
b n - 3
fi
b n - 4
fi
b n - 4
fi
b n - 5
fi
b n - 3
fi
b n - 4
fi
b n - 5
Let’s Benchmark with Fibonacci (II)
• Good case to measure pro
fi
ler/proxy overhead
• Simulate a big call-tree
• Leaves are fast paths (early exits)
• => high overhead expected
• fib(n) ~~ number of messages
fi
b n - 1
fi
b n - 2
fi
b n - 3
fi
b n - 4
fi
b n - 4
fi
b n - 5
fi
b n - 3
fi
b n - 4
fi
b n - 5
Our Lower Bound is run:with:in:
35
run: aSelector with: anArrayOfObjects in: aReceiver
^ self
forwardMethod: originalMethod
withReceiver: aReceiver
withArguments: anArrayOfObjects
run:with:in: Performance vs fib(x)
• ~25x slower !
• Seems faster for lower args
• Noise due to µs measures?
36
0 10 20 30
0
5
10
15
20
25
Time
(relative
to
no
proxy)
Fibonacci Argument
* Averages of 100 runs in µs. X = 1 to: 28
run:with:in: Performance vs Messages
• Consistent ~25x overhead
• Cries for language
implementation
improvement (!!)
37 * Averages of 100 runs in µs.
0 300000 600000 900000 1200000
0
5
10
15
20
25
Time
(relative
to
no
proxy)
Messages
The Cost of Safety
• Safe method proxies are ~3000x worse
• Non-clean closures
• allocation
• thisContext rei
fi
cation
• More messages (!)
• #ensure:
• meta-recursion control
• #before, #after hooks
38
0 300000 600000 900000 1200000
0
1000
2000
3000
4000
Time
(relative
to
no
proxy)
Messages
* Averages of 100 runs in µs.
Can we get better?
• Down to ~400x just removing abstraction
• Inlinings (!!)
• to remove messages
• to avoid blocks
• di
ff
erentiate fast vs slow path
• concurrent, meta-recursive
39
0 300000 600000 900000 1200000
0
500
1000
1500
2000
2500
3000
3500
Time
(relative
to
no
proxy)
Messages
* Averages of 100 runs in µs.
Overhead of Call-Tree Construction
• 2 proxy variants
• Generic: handler object
• Customized: inlined handler
• 2 instrumentation variants
• Online: build the call tree while executing
• Delayed: trace the minimum to build it in a post-process
• Comparison Baseline: safe+opt proxy with no instrumentation
40 * Averages of 100 runs in µs.
Call-tree construction
• Generic + Online was o
ff
the charts :)
• => o
ff
the presentation too
• Delaying the analysis is the best
• Customization gets only slightly better
• removes 4 messages per call
41 * Averages of 100 runs in µs.
0 300000 600000 900000 1200000
0
2
4
6
8
10
12
Time
(relative
to
Generic
Online
Analysis)
Messages
Generic - No Instrumentation
Customized Proxy - Online Analysis
Generic Proxy - Delayed Analysis
Customized Proxy - Delayed Analysis
Call-tree construction
• Generic + Online was o
ff
the charts :)
• => o
ff
the presentation too
• Delaying the analysis is the best
• Customization gets only slightly better
• removes 4 messages per call
42 * Averages of 100 runs in µs.
0 300000 600000 900000 1200000
0
2
4
6
8
10
12
Time
(relative
to
Generic
Online
Analysis)
Messages
Generic - No Instrumentation
Customized Proxy - Online Analysis
Generic Proxy - Delayed Analysis
Customized Proxy - Delayed Analysis
Zooming in
• Delayed is ~1.25x proxy alone
~1.25 * 400x (safety) ~= ~500x overhead
(over no instrumentation)
43 * Averages of 100 runs in µs.
0 300000 600000 900000 1200000
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
Time
(relative
to
Generic
Online
Analysis) Messages
Generic - No Instrumentation
Generic Proxy - Delayed Analysis
Customized Proxy - Delayed Analysis
Profiling the Compiler — again
• Partial Instrumentation
• Down from ~110x to ~12x
44
Baseline
Generic+Online
Customized+Delayed
0.0
20.0
40.0
60.0
80.0
100.0
120.0
140.0
Time
(relative
to
no
instrumentation)
prf := PrfMethodProfiler new.
prf addPackage: OpalCompiler package.
prf addPackage: RBParser package.
prf profile: [ Integer recompile ].
Takeaways
• Users need native language support for instrumentation
• Safe, strati
fi
ed and **e
ffi
cient**
• Low-level hooks are not enough: they miss abstractions
• Think twice when writing your own proxy implementation!
• Think concurrency, think stack unwind, thing meta-recursions
45 * Supported by AlaMVic Action Exploratoire INRIA
Evref
fervE
https://github.com/pharo-contributions/MethodProxies
https://github.com/pharo-contributions/MethodPro
fi
ler

More Related Content

PDF
MethodProxies: A Safe and Fast Message-Passing Control Library
PDF
Efficient call path detection for android os size of huge source code
PDF
EFFICIENT CALL PATH DETECTION FOR ANDROID-OS SIZE OF HUGE SOURCE CODE
PDF
Reducing Redundancies in Multi-Revision Code Analysis
PDF
HPC Application Profiling and Analysis
PPTX
HPC Application Profiling & Analysis
PDF
Stale pointers are the new black - white paper
PDF
Identification of unnecessary object allocations using static escape analysis
MethodProxies: A Safe and Fast Message-Passing Control Library
Efficient call path detection for android os size of huge source code
EFFICIENT CALL PATH DETECTION FOR ANDROID-OS SIZE OF HUGE SOURCE CODE
Reducing Redundancies in Multi-Revision Code Analysis
HPC Application Profiling and Analysis
HPC Application Profiling & Analysis
Stale pointers are the new black - white paper
Identification of unnecessary object allocations using static escape analysis

Similar to Instrumentation & the Pitfalls of Abstraction (20)

PDF
Callgraph analysis
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
PDF
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
PDF
Java reflection
PDF
JRuby 9000 - Optimizing Above the JVM
PPT
Testing
PDF
Co occurring code critics
PPTX
White box testing
PPTX
Tools for the Toolmakers
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
PDF
Changes and Bugs: Mining and Predicting Development Activities
PDF
20100309 02 - Software testing (McCabe)
PPTX
Code instrumentation
PDF
Fighting the Branch Predictor (ESUG 2025)
PPTX
Cyclomatic complexity
PDF
Testing parallel programs
PPT
Mod06 new development tools
PPTX
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
PDF
Message in a bottle
PDF
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
Callgraph analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
Java reflection
JRuby 9000 - Optimizing Above the JVM
Testing
Co occurring code critics
White box testing
Tools for the Toolmakers
Beyond Breakpoints: A Tour of Dynamic Analysis
Changes and Bugs: Mining and Predicting Development Activities
20100309 02 - Software testing (McCabe)
Code instrumentation
Fighting the Branch Predictor (ESUG 2025)
Cyclomatic complexity
Testing parallel programs
Mod06 new development tools
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Message in a bottle
Chronicler: Lightweight Recording to Reproduce Field Failures (Presented at I...
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
PDF
Fluid Class Definitions in Pharo (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Fluid Class Definitions in Pharo (ESUG 2025)
Ad

Recently uploaded (20)

PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
L1 - Introduction to python Backend.pptx
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Nekopoi APK 2025 free lastest update
PDF
System and Network Administraation Chapter 3
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Cost to Outsource Software Development in 2025
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
PTS Company Brochure 2025 (1).pdf.......
Wondershare Filmora 15 Crack With Activation Key [2025
L1 - Introduction to python Backend.pptx
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Digital Strategies for Manufacturing Companies
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Design an Analysis of Algorithms II-SECS-1021-03
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Nekopoi APK 2025 free lastest update
System and Network Administraation Chapter 3
How to Choose the Right IT Partner for Your Business in Malaysia
Cost to Outsource Software Development in 2025
Design an Analysis of Algorithms I-SECS-1021-03
wealthsignaloriginal-com-DS-text-... (1).pdf
Understanding Forklifts - TECH EHS Solution
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Upgrade and Innovation Strategies for SAP ERP Customers
Computer Software and OS of computer science of grade 11.pptx
Why Generative AI is the Future of Content, Code & Creativity?
PTS Company Brochure 2025 (1).pdf.......

Instrumentation & the Pitfalls of Abstraction

  • 1. Instrumentation & the Pitfalls of Abstraction ESUG - 2023 - Lyon * Supported by AlaMVic Action Exploratoire INRIA guillermo.polito@inria.fr @guillep Evref fervE 1 Generated by DALL-E
  • 2. First: About Me 2 Evref fervE • Keywords: compilers, testing, test generation • Ph.D.: Re fl ection, debloating, dynamic updates • Interests: tooling, benchmarking, 日本語, board games, concurrency Talk to me! Or: guillermo.polito@inria.fr guillermo.polito@inria.fr @guillep
  • 3. Building Dynamic Analyses • Dynamic call graphs • Code coverage • Pro fi lers • Time • Number of calls 3
  • 5. Remember Method Lookup sender receiver class s1 s2 … s4 … m1 m2 m3 s2 superclass s1 … s5 … inherits from instance of reference message 5
  • 6. sender receiver class s1 s2 … s4 … m1 m3 s2 superclass s1 … s5 … Objects as methods o1 inherits from instance of reference message 6
  • 7. sender receiver class s1 s2 … s4 … m1 m3 s2 superclass s1 … s5 … Objects as methods + run:with:in: o1 run:with:in: inherits from instance of reference message 7
  • 8. How far can we get with run:with:in: ? 8
  • 9. A First Method Proxy run: aSelector with: anArrayOfObjects in: aReceiver | result | self logBefore: aSelector. result := self forwardMethod: originalMethod withReceiver: aReceiver withArguments: anArrayOfObjects. self logAfter: aSelector. ^ result 9
  • 10. Let’s instrument factorial doit 17 px log: fwd… factorial run:with:in: 10
  • 11. doit 17 Let’s instrument factorial px log: fwd… run:with:in: factorial 11
  • 12. Let’s instrument factorial doit 17 px log: fwd… run:with:in: factorial 16 factorial … 12
  • 13. Let’s instrument factorial doit 17 px log: fwd… run:with:in: factorial 16 px log: fwd… run:with:in: factorial … 13
  • 14. Let’s get a bit more hardcore 14
  • 18. Meta-Recursions doit aSet add: px run:with:in: log: otherSet add: run:with:in: • The instrumentation gets instrumented! • And, with more complex instrumentation, more di ffi cult to debug • The burden: on the developer 18
  • 22. And That’s not All • Stack unwind (non-local returns, exceptions) pass around the logAfter: • Concurrent access to our instrumentation zone? • lose logs • break the instrumentation • Maybe we can do some concessions: e.g., do not proxy the proxy… This burden, is on the developer 22
  • 23. The Cost of Missing Abstraction • The language gives us only low-level instrumentation hooks • #run:with:in: • #doesNotUnderstand: • #cannotInterpret: • i.e., they are at the wrong level of abstraction for proper instrumentation Covering the GAP, is on the developer 23
  • 24. The Proxy We Have doit aSet add: px run:with:in: log: otherSet add: Instrumentation zone 24
  • 25. The Stratified Proxy We Want doit aSet add: px run:with:in: log: otherSet add: Instrumentation zone handler before: after: Infrastructure • Meta-recursion • Concurrency User concern • logging? • analysis? 25
  • 27. Safe Method Proxies + Exact Method Profiler • Method Proxies: https://github.com/pharo-contributions/MethodProxies • Method Pro fi ler: https://github.com/pharo-contributions/MethodPro fi ler • + common instrumentation layer between proxies and meta-links ! 27
  • 28. Let’s get a bit more hardcore again 28
  • 29. Let’s Instrument the Compiler prf := PrfMethodProfiler new. prf addPackage: OpalCompiler package. prf addPackage: RBParser package. prf profile: [ Integer recompile ]. 29
  • 32. ^ self < 2 ifTrue: [1] ifFalse: [ (self-1) benchFib + (self-2) benchFib + 1]
  • 33. Let’s Benchmark with Fibonacci • Best case for proxy infrastructure • no exceptions • no non-local return • no meta-recursion • no concurrent usages by default fi b n - 1 fi b n - 2 fi b n - 3 fi b n - 4 fi b n - 4 fi b n - 5 fi b n - 3 fi b n - 4 fi b n - 5
  • 34. Let’s Benchmark with Fibonacci (II) • Good case to measure pro fi ler/proxy overhead • Simulate a big call-tree • Leaves are fast paths (early exits) • => high overhead expected • fib(n) ~~ number of messages fi b n - 1 fi b n - 2 fi b n - 3 fi b n - 4 fi b n - 4 fi b n - 5 fi b n - 3 fi b n - 4 fi b n - 5
  • 35. Our Lower Bound is run:with:in: 35 run: aSelector with: anArrayOfObjects in: aReceiver ^ self forwardMethod: originalMethod withReceiver: aReceiver withArguments: anArrayOfObjects
  • 36. run:with:in: Performance vs fib(x) • ~25x slower ! • Seems faster for lower args • Noise due to µs measures? 36 0 10 20 30 0 5 10 15 20 25 Time (relative to no proxy) Fibonacci Argument * Averages of 100 runs in µs. X = 1 to: 28
  • 37. run:with:in: Performance vs Messages • Consistent ~25x overhead • Cries for language implementation improvement (!!) 37 * Averages of 100 runs in µs. 0 300000 600000 900000 1200000 0 5 10 15 20 25 Time (relative to no proxy) Messages
  • 38. The Cost of Safety • Safe method proxies are ~3000x worse • Non-clean closures • allocation • thisContext rei fi cation • More messages (!) • #ensure: • meta-recursion control • #before, #after hooks 38 0 300000 600000 900000 1200000 0 1000 2000 3000 4000 Time (relative to no proxy) Messages * Averages of 100 runs in µs.
  • 39. Can we get better? • Down to ~400x just removing abstraction • Inlinings (!!) • to remove messages • to avoid blocks • di ff erentiate fast vs slow path • concurrent, meta-recursive 39 0 300000 600000 900000 1200000 0 500 1000 1500 2000 2500 3000 3500 Time (relative to no proxy) Messages * Averages of 100 runs in µs.
  • 40. Overhead of Call-Tree Construction • 2 proxy variants • Generic: handler object • Customized: inlined handler • 2 instrumentation variants • Online: build the call tree while executing • Delayed: trace the minimum to build it in a post-process • Comparison Baseline: safe+opt proxy with no instrumentation 40 * Averages of 100 runs in µs.
  • 41. Call-tree construction • Generic + Online was o ff the charts :) • => o ff the presentation too • Delaying the analysis is the best • Customization gets only slightly better • removes 4 messages per call 41 * Averages of 100 runs in µs. 0 300000 600000 900000 1200000 0 2 4 6 8 10 12 Time (relative to Generic Online Analysis) Messages Generic - No Instrumentation Customized Proxy - Online Analysis Generic Proxy - Delayed Analysis Customized Proxy - Delayed Analysis
  • 42. Call-tree construction • Generic + Online was o ff the charts :) • => o ff the presentation too • Delaying the analysis is the best • Customization gets only slightly better • removes 4 messages per call 42 * Averages of 100 runs in µs. 0 300000 600000 900000 1200000 0 2 4 6 8 10 12 Time (relative to Generic Online Analysis) Messages Generic - No Instrumentation Customized Proxy - Online Analysis Generic Proxy - Delayed Analysis Customized Proxy - Delayed Analysis
  • 43. Zooming in • Delayed is ~1.25x proxy alone ~1.25 * 400x (safety) ~= ~500x overhead (over no instrumentation) 43 * Averages of 100 runs in µs. 0 300000 600000 900000 1200000 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 Time (relative to Generic Online Analysis) Messages Generic - No Instrumentation Generic Proxy - Delayed Analysis Customized Proxy - Delayed Analysis
  • 44. Profiling the Compiler — again • Partial Instrumentation • Down from ~110x to ~12x 44 Baseline Generic+Online Customized+Delayed 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0 Time (relative to no instrumentation) prf := PrfMethodProfiler new. prf addPackage: OpalCompiler package. prf addPackage: RBParser package. prf profile: [ Integer recompile ].
  • 45. Takeaways • Users need native language support for instrumentation • Safe, strati fi ed and **e ffi cient** • Low-level hooks are not enough: they miss abstractions • Think twice when writing your own proxy implementation! • Think concurrency, think stack unwind, thing meta-recursions 45 * Supported by AlaMVic Action Exploratoire INRIA Evref fervE https://github.com/pharo-contributions/MethodProxies https://github.com/pharo-contributions/MethodPro fi ler