SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
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)

Más contenido relacionado

Similar a 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
 
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
 
Deep Learning Inference at speed and scale
Deep Learning Inference at speed and scaleDeep Learning Inference at speed and scale
Deep Learning Inference at speed and scaleBill Liu
 

Similar a 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
 
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
 
Deep Learning Inference at speed and scale
Deep Learning Inference at speed and scaleDeep Learning Inference at speed and scale
Deep Learning Inference at speed and scale
 

Más de 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
 

Más de 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
 

Último

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Último (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

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)