SlideShare a Scribd company logo
Agenda

• Why Performance Matters
• How You Can Improve Performance




                                    3
Why Performance Matters

• Attractive to users

• Looks more professional

• Help you get things done more efficiently

• Keeps the flow




                                              4
Why Performance Matters
• An example explains more than a thousand words




                                                   5
Why Performance Matters

• Performance is more important than ever before
   – Dynamic user interfaces

• Qt Everywhere
  – Desktop
  – Embedded platforms with limited hardware

• We cannot just buy better hardware anymore

• Clock speed vs. number of cores



                                                   6
Why Performance Matters

• Not all applications can take advantage of
  multiple cores

• And some will actually run slower:
   – Each core in the processor is slower

   – Most applications not programmed to be multi-
     threaded

• Multi-core crisis?


                                                     7
Agenda

• Why Performance Matters
• How You Can Improve Performance




                                    19
How You Can Improve Performance
• Theory of Constraints (TOC) by Eliyahu M. Goldratt
• The theory is based on the idea that in any complex
  system, there is usually one aspect of that system that
  limits its ability to achieve its goal or optimal
  functioning. To achieve any significant improvement of
  the system, the constraint must be identified and
  resolved.

• Applications will perform as fast as their bottlenecks




                                                            20
Theory of Constraints
• Define a goal:
   – For example: This application must run at 30 FPS

• Then:
   1) Identify the constraint
   2) Decide how to exploit the constraint
   3) Improve
   4) If goal not reached, go back to 1)
   5) Done




                                                        21
Identifying hot spots (1)
• The number one and most important task

• Make sure you have plausible data

• Don't randomly start looking for slow code paths!
   – An O(n2) algorithm isn't necessarily bad
   – Don't spend time on making it O(n log n) just for fun

• Don't spend time on optimizing bubble sort




                                                             22
Identifying hot spots (1)
                      • “Bottlenecks occur in
                        surprising places, so
                        don't try second guess
                        and put in a speed hack
                        until you have proven
                        that is where the
                        bottleneck is” -- Rob Pike



                                                     23
Identifying hot spots (1)
• The right approach for identifying hot spots:

   – Any profiler suitable for your platform
      • Shark (Mac OSX)
      • Valgrind (X11)
      • Visual Studio Profiler (Windows)
      • Embedded Trace Macrocell (ETM) (ARM devices)
• NB! Always profile in release mode




                                                       24
Identifying hot spots (1)
• Run application: “valgrind --tool=callgrind ./application”

• This will collect data and information about the program

• Data saved to file: callgrind.out.<pid>

• Beware:
   – I/O costs won't show up
   – Cache misses (--simulate-cache=yes)
• The next step is to analyze the data/profile
• Example



                                                               25
Identifying hot spots (1)
• Profiling a section of code (run with “–instr-atstart=no”):


              #include<BbrValgrind/callgrind.h>

              int myFunction() const
              {
                 CALLGRIND_START_INSTRUMENTATION;

                  int number = 10;
                  ...

                  CALLGRIND_STOP_INSTRUMENTATION;
                  CALLGRIND_DUMP_STATS;

                  return number;
              }



                                                                26
Identifying hot spots (1)
• When a hot-spot is identified:
  – Look at the code and ask yourself: Is this the right
    algorithm for this task?

• Once the best algorithm is selected, you can exploit the
  constraint




                                                             27
How to exploit the constraint (2)
• Optimize
   – Design level
   – Source code level
   – Compile level

• Optimization trade-offs:
   – Memory consumption, cache misses
   – Code clarity and conciseness




                                        28
Theory of Constraints
• Define a goal:
   – For example: This application must run at 30 FPS

• Then:
   1) Identify the constraint
   2) Decide how to exploit the constraint
   3) Improve
   4) If goal not reached, go back to 1)
   5) Done




                                                        65

More Related Content

What's hot (20)

PPT
Qt Programming on TI Processors
Prabindh Sundareson
 
PPTX
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
 
PDF
Introduction to FreeRTOS
ICS
 
PPT
Animation Framework: A Step Towards Modern UIs
account inactive
 
PPTX
Qt for beginners part 1 overview and key concepts
ICS
 
PDF
Qt State Machine Framework
account inactive
 
PPTX
Qt for beginners part 5 ask the experts
ICS
 
PDF
Necessitas - Qt on Android - from FSCONS 2011
Johan Thelin
 
PDF
Software Development Best Practices: Separating UI from Business Logic
ICS
 
PDF
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Jakarta_EE
 
ODP
Qt Workshop
Johan Thelin
 
PDF
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
ICS
 
PDF
Qt Internationalization
ICS
 
PDF
Qt for beginners part 4 doing more
ICS
 
PDF
Introduction to QtWebKit
Ariya Hidayat
 
PDF
So I Downloaded Qt, Now What?
Janel Heilbrunn
 
ODP
Cross Platform Qt
Johan Thelin
 
PPT
了解 Qt
Chi Zhang
 
PDF
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Anne Nicolas
 
PPTX
Testing Java Microservices: From Development to Production
Daniel Bryant
 
Qt Programming on TI Processors
Prabindh Sundareson
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
 
Introduction to FreeRTOS
ICS
 
Animation Framework: A Step Towards Modern UIs
account inactive
 
Qt for beginners part 1 overview and key concepts
ICS
 
Qt State Machine Framework
account inactive
 
Qt for beginners part 5 ask the experts
ICS
 
Necessitas - Qt on Android - from FSCONS 2011
Johan Thelin
 
Software Development Best Practices: Separating UI from Business Logic
ICS
 
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Jakarta_EE
 
Qt Workshop
Johan Thelin
 
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
ICS
 
Qt Internationalization
ICS
 
Qt for beginners part 4 doing more
ICS
 
Introduction to QtWebKit
Ariya Hidayat
 
So I Downloaded Qt, Now What?
Janel Heilbrunn
 
Cross Platform Qt
Johan Thelin
 
了解 Qt
Chi Zhang
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Anne Nicolas
 
Testing Java Microservices: From Development to Production
Daniel Bryant
 

Similar to Smashing the bottleneck: Qt application profiling (20)

PPT
Software Performance
Prabhanshu Saraswat
 
PDF
Performance - a challenging craft
Fabian Lange
 
PDF
Slides Cost Based Performance Modelling
Eugene Margulis
 
PDF
Online performance modeling and analysis of message-passing parallel applicat...
MOCA Platform
 
PPT
Software Security in the Real World
Mark Curphey
 
KEY
Whose View is it Anyway: Addressing Multiple Stakeholder Concerns
sferoz
 
PPT
OO Development 1 - Introduction to Object-Oriented Development
Randy Connolly
 
PDF
The Laws of User Experience: Making it or Breaking It with the UX Factor
Effective
 
PDF
The Laws of User Experience: Making it or breaking it with the UX Factor
EffectiveUI
 
PPTX
Non Functional Requirement.
Khushboo Shaukat
 
PPTX
Integrating security into Continuous Delivery
Tom Stiehm
 
PDF
Beyond IT optimization there is a (promised) land of application performance ...
Leonid Grinshpan, Ph.D.
 
PDF
XP-Manchester 2013 Software Architecture for Agile Developers Intro
Chris F Carroll
 
PDF
Oop01 6
schwaa
 
PDF
Performance? That's what version 2 is for!
Eduard Tudenhoefner
 
PDF
Peddle the Pedal to the Metal
C4Media
 
PDF
Dirty Little Secret - Mobile Applications Invading Your Privacy
Tyler Shields
 
PDF
Cost Based Performance Modelling
Eugene Margulis
 
PPTX
My talk at PMI Sweden Congress 2013 on Agile and Large Software Products
Svante Lidman
 
PPTX
05. performance-concepts-26-slides
Muhammad Ahad
 
Software Performance
Prabhanshu Saraswat
 
Performance - a challenging craft
Fabian Lange
 
Slides Cost Based Performance Modelling
Eugene Margulis
 
Online performance modeling and analysis of message-passing parallel applicat...
MOCA Platform
 
Software Security in the Real World
Mark Curphey
 
Whose View is it Anyway: Addressing Multiple Stakeholder Concerns
sferoz
 
OO Development 1 - Introduction to Object-Oriented Development
Randy Connolly
 
The Laws of User Experience: Making it or Breaking It with the UX Factor
Effective
 
The Laws of User Experience: Making it or breaking it with the UX Factor
EffectiveUI
 
Non Functional Requirement.
Khushboo Shaukat
 
Integrating security into Continuous Delivery
Tom Stiehm
 
Beyond IT optimization there is a (promised) land of application performance ...
Leonid Grinshpan, Ph.D.
 
XP-Manchester 2013 Software Architecture for Agile Developers Intro
Chris F Carroll
 
Oop01 6
schwaa
 
Performance? That's what version 2 is for!
Eduard Tudenhoefner
 
Peddle the Pedal to the Metal
C4Media
 
Dirty Little Secret - Mobile Applications Invading Your Privacy
Tyler Shields
 
Cost Based Performance Modelling
Eugene Margulis
 
My talk at PMI Sweden Congress 2013 on Agile and Large Software Products
Svante Lidman
 
05. performance-concepts-26-slides
Muhammad Ahad
 
Ad

More from Develer S.r.l. (20)

PDF
Trace32 lo-strumento-piu-completo-per-il-debug-di-un-sistema-linux
Develer S.r.l.
 
PDF
Sw libero rf
Develer S.r.l.
 
PDF
Engagement small
Develer S.r.l.
 
PDF
Farepipi
Develer S.r.l.
 
PDF
Cloud computing, in practice ~ develer workshop
Develer S.r.l.
 
PDF
Workshop su Android Kernel Hacking
Develer S.r.l.
 
PDF
BeRTOS Embedded Survey Summary 2011
Develer S.r.l.
 
PDF
Qt roadmap: the future of Qt
Develer S.r.l.
 
PDF
Qt Quick in depth
Develer S.r.l.
 
PDF
Qt Quick for dynamic UI development
Develer S.r.l.
 
PDF
Qt licensing: making the right choice
Develer S.r.l.
 
PDF
Qt everywhere a c++ abstraction platform
Develer S.r.l.
 
PDF
Qt Creator: the secret weapon of any c++ programmer
Develer S.r.l.
 
PDF
PyQt: rapid application development
Develer S.r.l.
 
PDF
Hybrid development using Qt webkit
Develer S.r.l.
 
PDF
Crossing the border with Qt: the i18n system
Develer S.r.l.
 
PDF
BeRTOS: Sistema Real Time Embedded Free
Develer S.r.l.
 
PDF
BeRTOS: Free Embedded RTOS
Develer S.r.l.
 
PDF
Develer - Company Profile
Develer S.r.l.
 
PDF
Bettersoftware Feedback 2009
Develer S.r.l.
 
Trace32 lo-strumento-piu-completo-per-il-debug-di-un-sistema-linux
Develer S.r.l.
 
Sw libero rf
Develer S.r.l.
 
Engagement small
Develer S.r.l.
 
Farepipi
Develer S.r.l.
 
Cloud computing, in practice ~ develer workshop
Develer S.r.l.
 
Workshop su Android Kernel Hacking
Develer S.r.l.
 
BeRTOS Embedded Survey Summary 2011
Develer S.r.l.
 
Qt roadmap: the future of Qt
Develer S.r.l.
 
Qt Quick in depth
Develer S.r.l.
 
Qt Quick for dynamic UI development
Develer S.r.l.
 
Qt licensing: making the right choice
Develer S.r.l.
 
Qt everywhere a c++ abstraction platform
Develer S.r.l.
 
Qt Creator: the secret weapon of any c++ programmer
Develer S.r.l.
 
PyQt: rapid application development
Develer S.r.l.
 
Hybrid development using Qt webkit
Develer S.r.l.
 
Crossing the border with Qt: the i18n system
Develer S.r.l.
 
BeRTOS: Sistema Real Time Embedded Free
Develer S.r.l.
 
BeRTOS: Free Embedded RTOS
Develer S.r.l.
 
Develer - Company Profile
Develer S.r.l.
 
Bettersoftware Feedback 2009
Develer S.r.l.
 
Ad

Recently uploaded (20)

PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 

Smashing the bottleneck: Qt application profiling

  • 1. Agenda • Why Performance Matters • How You Can Improve Performance 3
  • 2. Why Performance Matters • Attractive to users • Looks more professional • Help you get things done more efficiently • Keeps the flow 4
  • 3. Why Performance Matters • An example explains more than a thousand words 5
  • 4. Why Performance Matters • Performance is more important than ever before – Dynamic user interfaces • Qt Everywhere – Desktop – Embedded platforms with limited hardware • We cannot just buy better hardware anymore • Clock speed vs. number of cores 6
  • 5. Why Performance Matters • Not all applications can take advantage of multiple cores • And some will actually run slower: – Each core in the processor is slower – Most applications not programmed to be multi- threaded • Multi-core crisis? 7
  • 6. Agenda • Why Performance Matters • How You Can Improve Performance 19
  • 7. How You Can Improve Performance • Theory of Constraints (TOC) by Eliyahu M. Goldratt • The theory is based on the idea that in any complex system, there is usually one aspect of that system that limits its ability to achieve its goal or optimal functioning. To achieve any significant improvement of the system, the constraint must be identified and resolved. • Applications will perform as fast as their bottlenecks 20
  • 8. Theory of Constraints • Define a goal: – For example: This application must run at 30 FPS • Then: 1) Identify the constraint 2) Decide how to exploit the constraint 3) Improve 4) If goal not reached, go back to 1) 5) Done 21
  • 9. Identifying hot spots (1) • The number one and most important task • Make sure you have plausible data • Don't randomly start looking for slow code paths! – An O(n2) algorithm isn't necessarily bad – Don't spend time on making it O(n log n) just for fun • Don't spend time on optimizing bubble sort 22
  • 10. Identifying hot spots (1) • “Bottlenecks occur in surprising places, so don't try second guess and put in a speed hack until you have proven that is where the bottleneck is” -- Rob Pike 23
  • 11. Identifying hot spots (1) • The right approach for identifying hot spots: – Any profiler suitable for your platform • Shark (Mac OSX) • Valgrind (X11) • Visual Studio Profiler (Windows) • Embedded Trace Macrocell (ETM) (ARM devices) • NB! Always profile in release mode 24
  • 12. Identifying hot spots (1) • Run application: “valgrind --tool=callgrind ./application” • This will collect data and information about the program • Data saved to file: callgrind.out.<pid> • Beware: – I/O costs won't show up – Cache misses (--simulate-cache=yes) • The next step is to analyze the data/profile • Example 25
  • 13. Identifying hot spots (1) • Profiling a section of code (run with “–instr-atstart=no”): #include<BbrValgrind/callgrind.h> int myFunction() const { CALLGRIND_START_INSTRUMENTATION; int number = 10; ... CALLGRIND_STOP_INSTRUMENTATION; CALLGRIND_DUMP_STATS; return number; } 26
  • 14. Identifying hot spots (1) • When a hot-spot is identified: – Look at the code and ask yourself: Is this the right algorithm for this task? • Once the best algorithm is selected, you can exploit the constraint 27
  • 15. How to exploit the constraint (2) • Optimize – Design level – Source code level – Compile level • Optimization trade-offs: – Memory consumption, cache misses – Code clarity and conciseness 28
  • 16. Theory of Constraints • Define a goal: – For example: This application must run at 30 FPS • Then: 1) Identify the constraint 2) Decide how to exploit the constraint 3) Improve 4) If goal not reached, go back to 1) 5) Done 65