Ulf Hermann. October 8, 2014 / Qt Developer Days 2014. The Qt Company. Using The QML Profiler. Ulf Hermann. Why? What? How To. Examples.



Similar documents
Best Practices in Qt Quick/QML. Langston Ball Senior Qt Developer ICS, Inc.

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

A) What Web Browser do I need? B) Why I cannot view the most updated content? C) What can we find on the school website? Index Page Layout:

Blender 3D Animation

Working With Animation: Introduction to Flash

Maya 2014 Basic Animation & The Graph Editor

Overview of the Adobe Flash Professional CS6 workspace

Coherent GT Performance Best Practices

How To Change Your Site On Drupal Cloud On A Pcode On A Microsoft Powerstone On A Macbook Or Ipad (For Free) On A Freebie (For A Free Download) On An Ipad Or Ipa (For

A Tutorial on dynamic networks. By Clement Levallois, Erasmus University Rotterdam

Zing Vision. Answering your toughest production Java performance questions

Petrel TIPS&TRICKS from SCM

Why Threads Are A Bad Idea (for most purposes)

Contents. SiteBuilder User Manual

Creating mobile layout designs in Adobe Muse

Triggers & Actions 10

Automated Performance Testing of Desktop Applications

User Tutorial on Changing Frame Size, Window Size, and Screen Resolution for The Original Version of The Cancer-Rates.Info/NJ Application

OPERATION MANUAL. MV-410RGB Layout Editor. Version 2.1- higher

Intellect Platform - Tables and Templates Basic Document Management System - A101

FreeStockCharts.com Chart Set-up

What is LOG Storm and what is it useful for?

Publisher 2010 Cheat Sheet

Visualization of 2D Domains

Ad Hoc Reporting. Usage and Customization

How to rotoscope in Adobe After Effects

Netigate User Guide. Setup Introduction Questions Text box Text area Radio buttons Radio buttons Weighted...

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Using Microsoft Office to Manage Projects

Microsoft Access 2010 handout

What is Microsoft PowerPoint?

RADFORD UNIVERSITY. Radford.edu. Content Administrator s Guide

Tutorial: Biped Character in 3D Studio Max 7, Easy Animation

Livescribe Desktop for Windows User Guide VERSION 2.3.3

HOBOmobile User s Guide Android

Personal Computer Checklist (Google Chrome) RealPage, Inc.

WEB TRADER USER MANUAL

Working with Windows Live Movie Maker

macquarie.com.au/prime Charts Macquarie Prime and IT-Finance Advanced Quick Manual

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

Making Visio Diagrams Come Alive with Data

LEN s.r.l. Via S. Andrea di Rovereto 33 c.s CHIAVARI (GE) Tel Fax mailto: len@len.it url: http//

How to Make the Most of Excel Spreadsheets

Pristine s Day Trading Journal...with Strategy Tester and Curve Generator

Course Project Lab 3 - Creating a Logo (Illustrator)

Profiler User's Guide

NetBeans Profiler is an

Working with Windows Movie Maker

How To Create A Graph On An African Performance Monitor (Dvt)

ios 9 Accessibility Switch Control - The Missing User Guide Updated 09/15/15

6. If you want to enter specific formats, click the Format Tab to auto format the information that is entered into the field.

CHAPTER. Monitoring and Diagnosing

Joomla Article Advanced Topics: Table Layouts

ORACLE BUSINESS INTELLIGENCE WORKSHOP

Flash Tutorial Part I

Matterport Workshop 2.0. User Guide

An Oracle White Paper September Advanced Java Diagnostics and Monitoring Without Performance Overhead

Adaptive Enterprise Solutions

idisplay v.2.0 User Guide

SketchUp Instructions

LabVIEW Day 1 Basics. Vern Lindberg. 1 The Look of LabVIEW

Anime Studio Debut vs. Pro

Access 2007 Creating Forms Table of Contents

Introduction to ProForm Rapid elearning Studio. What is ProForm? The ProForm Course Authoring Tool allows you to quickly create

Adobe Captivate Tips for Success

Creating Hyperlinks & Buttons InDesign CS6

WP Popup Magic User Guide

Sitecore InDesign Connector 1.1

The Dashboard. Change ActivInspire's Look And Feel. ActivInspire Primary. ActivInspire Studio. <- Primary. Studio -> page 1

Creating Animated Apps

Java's garbage-collected heap

4.3. Windows. Tutorial

MONITORING PERFORMANCE IN WINDOWS 7

PowerPoint 2007: Basics Learning Guide

Design document Goal Technology Description

Tool - 1: Health Center

Introduction to Microsoft Word 2008

BI4.x Architecture SAP CEG & GTM BI

Adobe InDesign Creative Cloud

Microsoft PowerPoint 2010 Computer Jeopardy Tutorial

Creating Interactive PDF Forms

Load testing with. WAPT Cloud. Quick Start Guide

MICROSOFT OFFICE ACCESS NEW FEATURES

Reviewer s Guide. Morpheus Photo Animation Suite. Screenshots. Tutorial. Included in the Reviewer s Guide:

How To Write A Cq5 Authoring Manual On An Ubuntu Cq (Windows) (Windows 5) (Mac) (Apple) (Amd) (Powerbook) (Html) (Web) (Font

Welcome to icue! Version 4

Microsoft Publisher 2010 What s New!

Using Microsoft Picture Manager

Performance Testing. Based on slides created by Marty Stepp

Creating Fill-able Forms using Acrobat 8.0: Part 1

I ntroduction. Accessing Microsoft PowerPoint. Anatomy of a PowerPoint Window

ESET Endpoint Security 6 ESET Endpoint Antivirus 6 for Windows

Remote Desktop Protocol Performance

Chapter 4 Creating Charts and Graphs

Designing and Implementing Forms 34

Transcription:

Using The QML The Qt Company October 8, 2014 / Qt Developer Days 2014 1/28

Outline 1 Reasons for Using a Specialized for Qt Quick 2 The QML 3 Analysing Typical Problems 4 Live of Profiling and Optimization 5 for the QML 2/28

Outline 1 Reasons for Using a Specialized for Qt Quick 2 The QML 3 Analysing Typical Problems 4 Live of Profiling and Optimization 5 for the QML 3/28

Classical optmization workflow Minimize total time a program will take to run: Instrument binary to count and time function calls Or use an emulator that keeps track of function calls Create call statistics to see: which functions took most time which functions are called most often Go back and optimize those. Problematic with Qt Quick applications... 4/28

Profiling JIT-compiled code 5/28 QV4::SimpleScriptFunction::call(QV4::Managed*,QV4::CallData*) 0x0000000012c149f0 0x00000000127a0000 0x000000001279a000 0x00000000127a3840 QV4::Runtime::callProperty(...) QV4::Runtime::setProperty(...) Profiling QML code with Valgrind What functions does it call there? No useful results on JIT-compiled or interpreted code from general purpose profilers No symbolic information available No stack unwinding with non-emulating profilers

6/28 Long run time Single Signal Handler that runs for 40ms doesn t make big dent in statistics leads to 2 dropped frames in a row might be harmless when does it run? Relate single events on a timescale to pin down problems.

Many calls Badly timed object creation 7/28 Time for each object creation isn t significant here. Number of calls may be more interesting, but... their distribution over the frames is most important!

Outline 1 Reasons for Using a Specialized for Qt Quick 2 The QML 3 Analysing Typical Problems 4 Live of Profiling and Optimization 5 for the QML 8/28

The QML In Analyze mode of Qt Creator 1 start/stop profiling 2 control execution directly or profile external process 3 switch recording on and off while application is running to receive traces for specific time ranges. 4 select event types to be recorded (Qt Creator 3.3+) 5 clear current trace Save and load trace files from context menu. 9/28

Timeline View Pixmap Cache: slow loading or large pictures Animations, Scene Graph: composition of scene graph Memory Usage: JavaScript heap and garbage collector Binding, Signal Handling, JavaScript: QML/JavaScript execution times 10/28

Events View 11/28 Statistical profile of QML/JavaScript For problems that lend themselves to the classical workflow Optimize the overall most expensive bits to get a general speedup

Outline 1 Reasons for Using a Specialized for Qt Quick 2 The QML 3 Analysing Typical Problems 4 Live of Profiling and Optimization 5 for the QML 12/28

It s slow. What is wrong? Too much JavaScript executed in few frames? All JavaScript must return before GUI thread advances Frames delayed/dropped if GUI thread not ready Result: Unresponsive, stuttering UI Creating/Painting/Updating invisible items? Takes time in GUI thread Same effect as Too much JavaScript Triggering long running C++ functions? Paint methods, signal handlers, etc. triggered from QML Also takes time in GUI thread Harder to see in the QML profiler as C++ isn t profiled 13/28

Too much Javascript 14/28 Watch frame rate in Animations and Scene Graph Gaps and orange animation events are bad JavaScript category shows functions and run time Stay under 1000/60 16ms per frame

Invisible Items 15/28 Check again for dropped frames Check for many short bindings or signal handlers => Too many items updated per frame QSG_VISUALIZE=overdraw shows scene layout Watch for items outside the screen or underneath visible elements

Long running C++ functions Dropped frames, but no JavaScript running? Large unexplained gaps in the timeline? Check your custom QQuickItem implementations Use general purpose profiler to explore the details 16/28

Outline 1 Reasons for Using a Specialized for Qt Quick 2 The QML 3 Analysing Typical Problems 4 Live of Profiling and Optimization 5 for the QML 17/28

Example 1: Too much JavaScript Glitch in SameGame example when starting new game 18/28

Example 1: Too much JavaScript Glitch in SameGame example when starting new game All items created from one JavaScript function call Takes about 100ms About 7 dropped frames in a row Enough unused CPU time during menu removal animation 18/28

Example 1: Too much JavaScript Glitch in SameGame example when starting new game All items created from one JavaScript function call Takes about 100ms About 7 dropped frames in a row Enough unused CPU time during menu removal animation Solution: Create invisible items during menu animation Later only set them visible Setting visibility is cheaper than creating items 18/28

Conventions for profiling Qt Creator gray color scheme: profiling one of the others red color scheme: buggy pre-3.0 as bad example green color scheme: v3.3 preview blue color scheme: patched v3.3 preview Trace files are just loaded into colored Qt Creators to trigger activity. Don t interpret the data. 19/28

Example 2: Even more JavaScript QML stutters on horizontal resizing. 20/28

Example 2: Even more JavaScript QML stutters on horizontal resizing. Overview always iterates all events to paint itself is implemented in JavaScript but: only updated on loading and resizing 20/28

20/28 Example 2: Even more JavaScript QML stutters on horizontal resizing. Overview always iterates all events to paint itself is implemented in JavaScript but: only updated on loading and resizing Solution 1 : Stretch the code over multiple frames Use Timer to trigger deferred JavaScript execution ontriggered should not take longer than a frame (around 16ms) Downside: Overview painting is animated now 1 with potential for further optimization

Example 3: Painting outside viewport Slow scrolling if timeline categories expanded 21/28

Example 3: Painting outside viewport Slow scrolling if timeline categories expanded Coordinate system marks cover a large space in vertical direction can take a long time to paint (up to 10ms) are mostly invisible most of the time. 21/28

21/28 Example 3: Painting outside viewport Slow scrolling if timeline categories expanded Coordinate system marks cover a large space in vertical direction can take a long time to paint (up to 10ms) are mostly invisible most of the time. Solution 2 : Only paint visible part of coordinate system Directly set virtual contentheight on Flickable Painted area sliding in virtual contentheight Reduces painting time to about 1-2ms 2 with potential for further optimization

Example 4: Expensive C++ Timeline scrolling still slow for some traces 22/28

Example 4: Expensive C++ Timeline scrolling still slow for some traces Timeline data painted for all categories, no matter how many are visible Takes a lot of time, especially in dense places. Hard to see in QML, as painting is implemented in C++. QSG_VISUALIZE=overdraw can help. 22/28

Example 4: Expensive C++ Timeline scrolling still slow for some traces Timeline data painted for all categories, no matter how many are visible Takes a lot of time, especially in dense places. Hard to see in QML, as painting is implemented in C++. QSG_VISUALIZE=overdraw can help. Solution 3 : Again, only paint visible part of timeline. Same technique as with coordinate system. 22/28 3 with potential for further optimization

Example 5: What about the labels? Hiccup when expanding large categories 23/28

Example 5: What about the labels? Hiccup when expanding large categories Repeater creates all elements at the same time. Use ListView to create and delete on demand? Potentially save some memory? 23/28

Example 5: What about the labels? Hiccup when expanding large categories Repeater creates all elements at the same time. Use ListView to create and delete on demand? Potentially save some memory? But: Labels are rarely updated. On-demand creation and removal during scrolling, when a lot of other code has to run? Creation and removal triggers garbage collector. Solution: Probably not worth it in this case 23/28

Outline 1 Reasons for Using a Specialized for Qt Quick 2 The QML 3 Analysing Typical Problems 4 Live of Profiling and Optimization 5 for the QML 24/28

Better Scene Graph Profiling 25/28 Will be included in Professional and Enterprise packages of Qt Creator 3.3 Visualizes all the timing information available from the scene graph

JavaScript Heap profiler 26/28 UI in Qt Creator 3.2+ (Professional and Enterprise) Will be usable with Qt 5.4+ Tracks page allocations of the memory manager Tracks memory allocations on JavaScript heap Shows when the garbage collector runs

Selective recording Switch off recording of events you re not interested in Reduces amount of data created Record longer traces without running into memory bottlenecks Smaller trace files, faster loading 27/28

Various UI improvements Drag&Drop reordering of categories Completely hide categories to reduce height of timeline Resize rows in timeline 28/28