SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Counting Messages as a
   Proxy for Average
Execution Time in Pharo

       ECOOP 2011 - Lancaster

            Alexandre Bergel
   Pleiad lab, DCC, University of Chile
             http://bergel.eu
The Mondrian Visualization Engine




     www.pharo-project.org

                                    2
“I like the cool new features of Mondrian, but in my setting,
drawing a canvas takes 10 seconds, whereas it took only 7
yesterday. Please do something!”
                                 -- A Mondrian user, 2009 --




                                                                3
“I like the cool new features of Mondrian, but in my setting,
drawing my visualization takes 10 seconds, whereas it took
only 7 yesterday. Please do something!”
                                 -- A Mondrian user, 2009 --




                                                                4
Result of Pharo 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:
        ...




                                                               5
Yesterday version


32.9% {6303ms} MOCanvas>>drawOn:
  32.9% {6303ms} MORoot(MONode)>>displayOn:
   24.4% {4485ms} MONode>>displayOn:
      | 12.5% {1899ms} MOEdge>>displayOn:
         ...
      | 4.2% {1033ms} MOEdge>>displayOn:
      |     | 6.0% {1679ms} MOStraightLineShape>>display:on:
      |     | 2.4% {546ms} FormCanvas>>line:to:width:color:
        ...
   8.5% {2112ms} MOEdge>>displayOn:
        ...




                                                               6
“I like the cool new features of Mondrian, but in my setting,
drawing my visualization takes 10 seconds, whereas it took
only 7 yesterday. Please do something!”
                                 -- A Mondrian user, 2009 --




On my machine I find 11 and 6 seconds. What’s going on?




                                                                7
How profilers work

Sampling the method call stack every 10 ms
A counter is associated to each frame
Each counter is incremented when being sampled




                                                 8
How profilers work

   Sampling the method call stack every 10 ms
   A counter is associated to each frame
   Each counter is incremented when being sampled



                MONode displayOn: (1)
method call     MORoot displayOn: (1)
  stack
                 Canvas drawOn: (1)
                       Time = t
                                                    9
How profilers work

   Sampling the method call stack every 10 ms
   A counter is associated to each frame
   Each counter is incremented when being sampled

                MOEdge displayOn: (1)
                MONode displayOn: (2)
method call     MORoot displayOn: (2)
  stack
                 Canvas drawOn: (2)
                  Time = t + 10 ms
                                                    10
How profilers work

   Sampling the method call stack every 10 ms
   A counter is associated to each frame
   Each counter is incremented when being sampled



                MONode setCache (1)
method call     MORoot displayOn: (3)
  stack
                 Canvas drawOn: (3)
                  Time = t + 20 ms
                                                    11
How profilers work


 The counter is used to estimate the amount of time
spent
   MONode setCache (1)

   MOEdge displayOn: (1)

   MONode displayOn: (2)

   MORoot displayOn: (3)

   Canvas drawOn: (3)




                                                      12
How profilers work


 The counter is used to estimate the amount of time
spent
   MONode setCache (1) => 10 ms

   MOEdge displayOn: (1) => 10 ms

   MONode displayOn: (2) => 20 ms

   MORoot displayOn: (3) => 30 ms

   Canvas drawOn: (3)   => 30 ms




                                                      13
Problem with execution sampling #1



Strongly dependent on the executing environment
  CPU, memory management, threads, virtual machine, processes



Listening at a mp3 may perturb your profile




                                                                14
Problem with execution sampling #2



Non-determinism
  Even using the same environment does not help



“30000 factorial” takes between 3 803 and 3 869 ms




                                                     15
Problem with execution sampling #3



 Lack of portability
   Profiles are not reusable across platform



 Buying a new laptop will invalidate the profile you
made yesterday




                                                      16
Counting messages to the rescue


 Pharo is a Smalltalk dialect
 Intensively based on sending message
 Almost “Optimization-free compiler”


  Why not to count messages instead of execution
time?




                                                   17
Counting messages

Wallet >> increaseByOne
   money := money + 1

Wallet >> addBonus
   self
     increaseByOne;
     increaseByOne;
     increaseByOne.


aWallet addBonus
=> 6 messages sent




                               18
Does this really work?


 What about the program?
MyClass >> main
   self waitForUserClick


 We took scenarios from unit tests, which do not rely
on user input




                                                        19
Experiment A

                          6
                   400 x 10
  message sends


                  400000000

                          6                                     application
                   300 x 10
                  300000000

                          6
                   200 x 10
                  200000000

                          6
                   100 x 10
                  100000000


                         0
                              0    10000   20000   30000    40000

                                                       times (ms)
 The number of sent messages related to the average
execution time over multiple executions                                       20
Experiment B
    Application time taken (ms) # sent messages ctime % cmessages %
    Collections           32 317     334 359 691   16.67       1.05
    Mondrian              33 719     292 140 717    5.54       1.44
    Nile                  29 264     236 817 521    7.24       0.22
    Moose                 25 021     210 384 157   24.56       2.47
    SmallDude             13 942     150 301 007   23.93       0.99
    Glamour               10 216       94 604 363   3.77       0.14
    Magritte               2 485       37 979 149   2.08       0.85
    PetitParser            1 642       31 574 383  46.99       0.52
    Famix                  1 014        6 385 091  18.30       0.06
    DSM                    4 012        5 954 759  25.71       0.17
    ProfStef                 247        3 381 429   0.77       0.10
    Network                  128        2 340 805   6.06       0.44
    AST                       37          677 439   1.26       0.46
    XMLParser                 36          675 205  32.94       0.46
    Arki                      30          609 633   1.44       0.35
    ShoutTests                19          282 313   5.98       0.11
    Average                                        13.95       0.61

Table 2.number of sent messages more stable third columns
  The Applications considered in our experiment (second and than the
are average overtime over multiple executions
 execution 10 runs)
                                                                       21
Experiment C

                                 6
   number of method

                      10000000
                      10.0 x 10
      invocations


                                 6
                                                                       method
                       7500000
                       7.5 x 10

                                 6
                       5.0 x 10
                       5000000

                                 6
                       2.5 x 10
                       2500000


                             0
                                  0      75   150    225        300
                                                           time (ms)

 The number of sent messages as useful as the
execution time to identify an execution bottleneck
                                                                                22
Compteur



CompteurMethod>> run: methodName with: args in: receiver
 | oldNumberOfCalls v |
 oldNumberOfCalls := self getNumberOfCalls.

 v := originalMethod valueWithReceiver: receiver arguments: args.

 numberOfCalls :=
  (self getNumberOfCalls - oldNumberOfCalls) + numberOfCalls - 5.
 ˆv



                                                                    23
New primitive in the VM



CompteurMethod>> run: methodName with: args in: receiver
 | oldNumberOfCalls v |
 oldNumberOfCalls := self getNumberOfCalls.

 v := originalMethod valueWithReceiver: receiver arguments: args.

 numberOfCalls :=
  (self getNumberOfCalls - oldNumberOfCalls) + numberOfCalls - 5.
 ˆv



                                                                    24
Cost of the instrumentation

Overhead (%)                                 Overhead (%)
    3000                                         10000


    2250                                         1000


    1500                                          100


     750                                           10


       0                                            1
           0   10000   20000    30000    40000           0   10000   20000    30000    40000
                           Execution time (ms)                           Execution time (ms)
                  (a) Linear scale                           (b) Logarithmic scale




                                                                                               25
Contrasting Execution Sampling with
         Message Counting



No need for sampling
Independent from the execution environment
Stable measurements




                                             26
Application #1
  Counting messages in unit testing



CollectionTest>>testInsertion
   self
     assert: [ Set new add: 1]
     fasterThan: [Set new add: 1; add: 2]




                                            27
Application #1
  Counting messages in unit testing
MondrianSpeedTest>> testLayout2
  | view1 view2 |
  view1 := MOViewRenderer new.
  view1 nodes: (Collection allSubclasses).
  view1 edgesFrom: #superclass.
  view1 treeLayout.

  view2   := MOViewRenderer new.
  view2   nodes: (Collection withAllSubclasses).
  view2   edgesFrom: #superclass.
  view2   treeLayout.

  self
   assertIs: [ view1 root applyLayout ]
   fasterThan: [ view2 root applyLayout ]
                                                   28
Application #2
                     Differencing profiling



                                  Comparison of two successive
                                     versions of a software




(not in the paper)                                         29
Application #2
                     Differencing profiling
                                  Comparison of two successive
                                     versions of Mondrian




(not in the paper)                                          30
More in the paper


 Linear regression model
 We replay some optimizations we had in our previous
work
 A methodology to evaluate profiler stability over
multiple run
 All the material to reproduce the experiments




                                                       31
Summary



 Counting method invocation is a more advantageous
profiling technique, in Pharo
 Stable correlation between message sending and
average execution time




                                                     32
Closing words



 The same abstractions are used to profile
applications written in C and in Java
 Which objects is responsible of a slowdown?
 Which arguments make a method call slow?
 ...




                                               33
6




                                                                                   number of method
                          6
                                                                                                      10000000
                                                                                                      10.0 x 10
                   400 x 10




                                                                                      invocations
  message sends
                  400000000
                                                                                                                 6
                          6
                                                                                                       7500000
                                                                                                       7.5 x 10
                   300 x 10
                  300000000

                          6                                                                                      6
                   200 x 10
                  200000000                                                                            5.0 x 10
                                                                                                       5000000

                          6                                                                                      6
                   100 x 10
                  100000000                                                                            2.5 x 10
                                                                                                       2500000


                          0
                              0    10000         20000   30000    40000                                      0
                                                                                                                  0    75     150        225        300
                                                             times (ms)                                                                        time (ms)


            Counting message as a proxy for average execution time
                             Alexandre Bergel
                              http://bergel.eu
                                  Overhead (%)                                                   Overhead (%)
                                       3000                                                             10000


CollectionTest>>testInsertion
                  2250                                                                                   1000
self
 assert: [Set new 1500 1]
                  add:                                                                                    100

 fasterThan: [Set new add: 1; add: 2]
                                           750                                                             10


                                            0                                                               1
                                                 0       10000    20000   30000
                                                                           34       40000                         0   10000   20000      30000      40000
                                                                     Execution time (ms)                                            Execution time (ms)

Weitere ähnliche Inhalte

Ähnlich wie 2011 ecoop

Python Programming - IX. On Randomness
Python Programming - IX. On RandomnessPython Programming - IX. On Randomness
Python Programming - IX. On RandomnessRanel Padon
 
MetaPerturb: Transferable Regularizer for Heterogeneous Tasks and Architectures
MetaPerturb: Transferable Regularizer for Heterogeneous Tasks and ArchitecturesMetaPerturb: Transferable Regularizer for Heterogeneous Tasks and Architectures
MetaPerturb: Transferable Regularizer for Heterogeneous Tasks and ArchitecturesMLAI2
 
Bifrost: Setting Smalltalk Loose
Bifrost: Setting Smalltalk LooseBifrost: Setting Smalltalk Loose
Bifrost: Setting Smalltalk LooseJorge Ressia
 
Enhancing the performance of kmeans algorithm
Enhancing the performance of kmeans algorithmEnhancing the performance of kmeans algorithm
Enhancing the performance of kmeans algorithmHadi Fadlallah
 
Domain-Specific Profiling - TOOLS 2011
Domain-Specific Profiling - TOOLS 2011Domain-Specific Profiling - TOOLS 2011
Domain-Specific Profiling - TOOLS 2011Jorge Ressia
 
Operating System Multiple Choice Questions
Operating System Multiple Choice QuestionsOperating System Multiple Choice Questions
Operating System Multiple Choice QuestionsShusil Baral
 
Optimizing Terascale Machine Learning Pipelines with Keystone ML
Optimizing Terascale Machine Learning Pipelines with Keystone MLOptimizing Terascale Machine Learning Pipelines with Keystone ML
Optimizing Terascale Machine Learning Pipelines with Keystone MLSpark Summit
 
Analysis Of Matrix Multiplication Computational Methods
Analysis Of Matrix Multiplication Computational MethodsAnalysis Of Matrix Multiplication Computational Methods
Analysis Of Matrix Multiplication Computational MethodsJoe Andelija
 
Octave - Prototyping Machine Learning Algorithms
Octave - Prototyping Machine Learning AlgorithmsOctave - Prototyping Machine Learning Algorithms
Octave - Prototyping Machine Learning AlgorithmsCraig Trim
 
03 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_0303 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_03Niit Care
 
Profiling ruby
Profiling rubyProfiling ruby
Profiling rubynasirj
 
Image orientation classification analysis
Image orientation classification analysisImage orientation classification analysis
Image orientation classification analysisRohit Dandona
 
TinyOS 2.1 Tutorial: Hands-on Session
TinyOS 2.1 Tutorial: Hands-on SessionTinyOS 2.1 Tutorial: Hands-on Session
TinyOS 2.1 Tutorial: Hands-on SessionRazvan Musaloiu-E.
 
Deep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesDeep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesAmazon Web Services
 
Interactive Latency in Big Data Visualization
Interactive Latency in Big Data VisualizationInteractive Latency in Big Data Visualization
Interactive Latency in Big Data Visualizationbigdataviz_bay
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfTulasiramKandula1
 
Dimemas and Multi-Level Cache Simulations
Dimemas and Multi-Level Cache SimulationsDimemas and Multi-Level Cache Simulations
Dimemas and Multi-Level Cache SimulationsMário Almeida
 
Treasure Data Summer Internship Final Report
Treasure Data Summer Internship Final ReportTreasure Data Summer Internship Final Report
Treasure Data Summer Internship Final ReportRitta Narita
 

Ähnlich wie 2011 ecoop (20)

dnp3 Protocol Master Client simulator user manual
dnp3 Protocol Master Client simulator user manualdnp3 Protocol Master Client simulator user manual
dnp3 Protocol Master Client simulator user manual
 
Python Programming - IX. On Randomness
Python Programming - IX. On RandomnessPython Programming - IX. On Randomness
Python Programming - IX. On Randomness
 
MetaPerturb: Transferable Regularizer for Heterogeneous Tasks and Architectures
MetaPerturb: Transferable Regularizer for Heterogeneous Tasks and ArchitecturesMetaPerturb: Transferable Regularizer for Heterogeneous Tasks and Architectures
MetaPerturb: Transferable Regularizer for Heterogeneous Tasks and Architectures
 
Bifrost: Setting Smalltalk Loose
Bifrost: Setting Smalltalk LooseBifrost: Setting Smalltalk Loose
Bifrost: Setting Smalltalk Loose
 
Enhancing the performance of kmeans algorithm
Enhancing the performance of kmeans algorithmEnhancing the performance of kmeans algorithm
Enhancing the performance of kmeans algorithm
 
Domain-Specific Profiling - TOOLS 2011
Domain-Specific Profiling - TOOLS 2011Domain-Specific Profiling - TOOLS 2011
Domain-Specific Profiling - TOOLS 2011
 
Operating System Multiple Choice Questions
Operating System Multiple Choice QuestionsOperating System Multiple Choice Questions
Operating System Multiple Choice Questions
 
Optimizing Terascale Machine Learning Pipelines with Keystone ML
Optimizing Terascale Machine Learning Pipelines with Keystone MLOptimizing Terascale Machine Learning Pipelines with Keystone ML
Optimizing Terascale Machine Learning Pipelines with Keystone ML
 
Analysis Of Matrix Multiplication Computational Methods
Analysis Of Matrix Multiplication Computational MethodsAnalysis Of Matrix Multiplication Computational Methods
Analysis Of Matrix Multiplication Computational Methods
 
Octave - Prototyping Machine Learning Algorithms
Octave - Prototyping Machine Learning AlgorithmsOctave - Prototyping Machine Learning Algorithms
Octave - Prototyping Machine Learning Algorithms
 
03 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_0303 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_03
 
Profiling ruby
Profiling rubyProfiling ruby
Profiling ruby
 
Nido
NidoNido
Nido
 
Image orientation classification analysis
Image orientation classification analysisImage orientation classification analysis
Image orientation classification analysis
 
TinyOS 2.1 Tutorial: Hands-on Session
TinyOS 2.1 Tutorial: Hands-on SessionTinyOS 2.1 Tutorial: Hands-on Session
TinyOS 2.1 Tutorial: Hands-on Session
 
Deep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instancesDeep Dive on Amazon EC2 instances
Deep Dive on Amazon EC2 instances
 
Interactive Latency in Big Data Visualization
Interactive Latency in Big Data VisualizationInteractive Latency in Big Data Visualization
Interactive Latency in Big Data Visualization
 
Introduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdfIntroduction to computing Processing and performance.pdf
Introduction to computing Processing and performance.pdf
 
Dimemas and Multi-Level Cache Simulations
Dimemas and Multi-Level Cache SimulationsDimemas and Multi-Level Cache Simulations
Dimemas and Multi-Level Cache Simulations
 
Treasure Data Summer Internship Final Report
Treasure Data Summer Internship Final ReportTreasure Data Summer Internship Final Report
Treasure Data Summer Internship Final Report
 

Mehr von bergel

Building Neural Network Through Neuroevolution
Building Neural Network Through NeuroevolutionBuilding Neural Network Through Neuroevolution
Building Neural Network Through Neuroevolutionbergel
 
Roassal presentation
Roassal presentationRoassal presentation
Roassal presentationbergel
 
2011 famoosr
2011 famoosr2011 famoosr
2011 famoosrbergel
 
Test beautycleanness
Test beautycleannessTest beautycleanness
Test beautycleannessbergel
 
Multi dimensional profiling
Multi dimensional profilingMulti dimensional profiling
Multi dimensional profilingbergel
 
Profiling blueprints
Profiling blueprintsProfiling blueprints
Profiling blueprintsbergel
 
The Pharo Programming Language
The Pharo Programming LanguageThe Pharo Programming Language
The Pharo Programming Languagebergel
 
2008 Sccc Inheritance
2008 Sccc Inheritance2008 Sccc Inheritance
2008 Sccc Inheritancebergel
 
2008 Sccc Smalltalk
2008 Sccc Smalltalk2008 Sccc Smalltalk
2008 Sccc Smalltalkbergel
 
Presentation of Traits
Presentation of TraitsPresentation of Traits
Presentation of Traitsbergel
 
2006 Seaside
2006 Seaside2006 Seaside
2006 Seasidebergel
 
2006 Small Scheme
2006 Small Scheme2006 Small Scheme
2006 Small Schemebergel
 
2004 Esug Prototalk
2004 Esug Prototalk2004 Esug Prototalk
2004 Esug Prototalkbergel
 
2005 Oopsla Classboxj
2005 Oopsla Classboxj2005 Oopsla Classboxj
2005 Oopsla Classboxjbergel
 
2006 Esug Omnibrowser
2006 Esug Omnibrowser2006 Esug Omnibrowser
2006 Esug Omnibrowserbergel
 

Mehr von bergel (15)

Building Neural Network Through Neuroevolution
Building Neural Network Through NeuroevolutionBuilding Neural Network Through Neuroevolution
Building Neural Network Through Neuroevolution
 
Roassal presentation
Roassal presentationRoassal presentation
Roassal presentation
 
2011 famoosr
2011 famoosr2011 famoosr
2011 famoosr
 
Test beautycleanness
Test beautycleannessTest beautycleanness
Test beautycleanness
 
Multi dimensional profiling
Multi dimensional profilingMulti dimensional profiling
Multi dimensional profiling
 
Profiling blueprints
Profiling blueprintsProfiling blueprints
Profiling blueprints
 
The Pharo Programming Language
The Pharo Programming LanguageThe Pharo Programming Language
The Pharo Programming Language
 
2008 Sccc Inheritance
2008 Sccc Inheritance2008 Sccc Inheritance
2008 Sccc Inheritance
 
2008 Sccc Smalltalk
2008 Sccc Smalltalk2008 Sccc Smalltalk
2008 Sccc Smalltalk
 
Presentation of Traits
Presentation of TraitsPresentation of Traits
Presentation of Traits
 
2006 Seaside
2006 Seaside2006 Seaside
2006 Seaside
 
2006 Small Scheme
2006 Small Scheme2006 Small Scheme
2006 Small Scheme
 
2004 Esug Prototalk
2004 Esug Prototalk2004 Esug Prototalk
2004 Esug Prototalk
 
2005 Oopsla Classboxj
2005 Oopsla Classboxj2005 Oopsla Classboxj
2005 Oopsla Classboxj
 
2006 Esug Omnibrowser
2006 Esug Omnibrowser2006 Esug Omnibrowser
2006 Esug Omnibrowser
 

Kürzlich hochgeladen

Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 

Kürzlich hochgeladen (20)

Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 

2011 ecoop

  • 1. Counting Messages as a Proxy for Average Execution Time in Pharo ECOOP 2011 - Lancaster Alexandre Bergel Pleiad lab, DCC, University of Chile http://bergel.eu
  • 2. The Mondrian Visualization Engine www.pharo-project.org 2
  • 3. “I like the cool new features of Mondrian, but in my setting, drawing a canvas takes 10 seconds, whereas it took only 7 yesterday. Please do something!” -- A Mondrian user, 2009 -- 3
  • 4. “I like the cool new features of Mondrian, but in my setting, drawing my visualization takes 10 seconds, whereas it took only 7 yesterday. Please do something!” -- A Mondrian user, 2009 -- 4
  • 5. Result of Pharo 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: ... 5
  • 6. Yesterday version 32.9% {6303ms} MOCanvas>>drawOn: 32.9% {6303ms} MORoot(MONode)>>displayOn: 24.4% {4485ms} MONode>>displayOn: | 12.5% {1899ms} MOEdge>>displayOn: ... | 4.2% {1033ms} MOEdge>>displayOn: | | 6.0% {1679ms} MOStraightLineShape>>display:on: | | 2.4% {546ms} FormCanvas>>line:to:width:color: ... 8.5% {2112ms} MOEdge>>displayOn: ... 6
  • 7. “I like the cool new features of Mondrian, but in my setting, drawing my visualization takes 10 seconds, whereas it took only 7 yesterday. Please do something!” -- A Mondrian user, 2009 -- On my machine I find 11 and 6 seconds. What’s going on? 7
  • 8. How profilers work Sampling the method call stack every 10 ms A counter is associated to each frame Each counter is incremented when being sampled 8
  • 9. How profilers work Sampling the method call stack every 10 ms A counter is associated to each frame Each counter is incremented when being sampled MONode displayOn: (1) method call MORoot displayOn: (1) stack Canvas drawOn: (1) Time = t 9
  • 10. How profilers work Sampling the method call stack every 10 ms A counter is associated to each frame Each counter is incremented when being sampled MOEdge displayOn: (1) MONode displayOn: (2) method call MORoot displayOn: (2) stack Canvas drawOn: (2) Time = t + 10 ms 10
  • 11. How profilers work Sampling the method call stack every 10 ms A counter is associated to each frame Each counter is incremented when being sampled MONode setCache (1) method call MORoot displayOn: (3) stack Canvas drawOn: (3) Time = t + 20 ms 11
  • 12. How profilers work The counter is used to estimate the amount of time spent MONode setCache (1) MOEdge displayOn: (1) MONode displayOn: (2) MORoot displayOn: (3) Canvas drawOn: (3) 12
  • 13. How profilers work The counter is used to estimate the amount of time spent MONode setCache (1) => 10 ms MOEdge displayOn: (1) => 10 ms MONode displayOn: (2) => 20 ms MORoot displayOn: (3) => 30 ms Canvas drawOn: (3) => 30 ms 13
  • 14. Problem with execution sampling #1 Strongly dependent on the executing environment CPU, memory management, threads, virtual machine, processes Listening at a mp3 may perturb your profile 14
  • 15. Problem with execution sampling #2 Non-determinism Even using the same environment does not help “30000 factorial” takes between 3 803 and 3 869 ms 15
  • 16. Problem with execution sampling #3 Lack of portability Profiles are not reusable across platform Buying a new laptop will invalidate the profile you made yesterday 16
  • 17. Counting messages to the rescue Pharo is a Smalltalk dialect Intensively based on sending message Almost “Optimization-free compiler” Why not to count messages instead of execution time? 17
  • 18. Counting messages Wallet >> increaseByOne money := money + 1 Wallet >> addBonus self increaseByOne; increaseByOne; increaseByOne. aWallet addBonus => 6 messages sent 18
  • 19. Does this really work? What about the program? MyClass >> main self waitForUserClick We took scenarios from unit tests, which do not rely on user input 19
  • 20. Experiment A 6 400 x 10 message sends 400000000 6 application 300 x 10 300000000 6 200 x 10 200000000 6 100 x 10 100000000 0 0 10000 20000 30000 40000 times (ms) The number of sent messages related to the average execution time over multiple executions 20
  • 21. Experiment B Application time taken (ms) # sent messages ctime % cmessages % Collections 32 317 334 359 691 16.67 1.05 Mondrian 33 719 292 140 717 5.54 1.44 Nile 29 264 236 817 521 7.24 0.22 Moose 25 021 210 384 157 24.56 2.47 SmallDude 13 942 150 301 007 23.93 0.99 Glamour 10 216 94 604 363 3.77 0.14 Magritte 2 485 37 979 149 2.08 0.85 PetitParser 1 642 31 574 383 46.99 0.52 Famix 1 014 6 385 091 18.30 0.06 DSM 4 012 5 954 759 25.71 0.17 ProfStef 247 3 381 429 0.77 0.10 Network 128 2 340 805 6.06 0.44 AST 37 677 439 1.26 0.46 XMLParser 36 675 205 32.94 0.46 Arki 30 609 633 1.44 0.35 ShoutTests 19 282 313 5.98 0.11 Average 13.95 0.61 Table 2.number of sent messages more stable third columns The Applications considered in our experiment (second and than the are average overtime over multiple executions execution 10 runs) 21
  • 22. Experiment C 6 number of method 10000000 10.0 x 10 invocations 6 method 7500000 7.5 x 10 6 5.0 x 10 5000000 6 2.5 x 10 2500000 0 0 75 150 225 300 time (ms) The number of sent messages as useful as the execution time to identify an execution bottleneck 22
  • 23. Compteur CompteurMethod>> run: methodName with: args in: receiver | oldNumberOfCalls v | oldNumberOfCalls := self getNumberOfCalls. v := originalMethod valueWithReceiver: receiver arguments: args. numberOfCalls := (self getNumberOfCalls - oldNumberOfCalls) + numberOfCalls - 5. ˆv 23
  • 24. New primitive in the VM CompteurMethod>> run: methodName with: args in: receiver | oldNumberOfCalls v | oldNumberOfCalls := self getNumberOfCalls. v := originalMethod valueWithReceiver: receiver arguments: args. numberOfCalls := (self getNumberOfCalls - oldNumberOfCalls) + numberOfCalls - 5. ˆv 24
  • 25. Cost of the instrumentation Overhead (%) Overhead (%) 3000 10000 2250 1000 1500 100 750 10 0 1 0 10000 20000 30000 40000 0 10000 20000 30000 40000 Execution time (ms) Execution time (ms) (a) Linear scale (b) Logarithmic scale 25
  • 26. Contrasting Execution Sampling with Message Counting No need for sampling Independent from the execution environment Stable measurements 26
  • 27. Application #1 Counting messages in unit testing CollectionTest>>testInsertion self assert: [ Set new add: 1] fasterThan: [Set new add: 1; add: 2] 27
  • 28. Application #1 Counting messages in unit testing MondrianSpeedTest>> testLayout2 | view1 view2 | view1 := MOViewRenderer new. view1 nodes: (Collection allSubclasses). view1 edgesFrom: #superclass. view1 treeLayout. view2 := MOViewRenderer new. view2 nodes: (Collection withAllSubclasses). view2 edgesFrom: #superclass. view2 treeLayout. self assertIs: [ view1 root applyLayout ] fasterThan: [ view2 root applyLayout ] 28
  • 29. Application #2 Differencing profiling Comparison of two successive versions of a software (not in the paper) 29
  • 30. Application #2 Differencing profiling Comparison of two successive versions of Mondrian (not in the paper) 30
  • 31. More in the paper Linear regression model We replay some optimizations we had in our previous work A methodology to evaluate profiler stability over multiple run All the material to reproduce the experiments 31
  • 32. Summary Counting method invocation is a more advantageous profiling technique, in Pharo Stable correlation between message sending and average execution time 32
  • 33. Closing words The same abstractions are used to profile applications written in C and in Java Which objects is responsible of a slowdown? Which arguments make a method call slow? ... 33
  • 34. 6 number of method 6 10000000 10.0 x 10 400 x 10 invocations message sends 400000000 6 6 7500000 7.5 x 10 300 x 10 300000000 6 6 200 x 10 200000000 5.0 x 10 5000000 6 6 100 x 10 100000000 2.5 x 10 2500000 0 0 10000 20000 30000 40000 0 0 75 150 225 300 times (ms) time (ms) Counting message as a proxy for average execution time Alexandre Bergel http://bergel.eu Overhead (%) Overhead (%) 3000 10000 CollectionTest>>testInsertion 2250 1000 self assert: [Set new 1500 1] add: 100 fasterThan: [Set new add: 1; add: 2] 750 10 0 1 0 10000 20000 30000 34 40000 0 10000 20000 30000 40000 Execution time (ms) Execution time (ms)