Utilizing Performance Unit Tests To Increase Performance Awareness - - PowerPoint PPT Presentation

utilizing performance unit tests to increase performance
SMART_READER_LITE
LIVE PREVIEW

Utilizing Performance Unit Tests To Increase Performance Awareness - - PowerPoint PPT Presentation

Utilizing Performance Unit Tests To Increase Performance Awareness Vojtch Hork, Peter Libi, Luk Marek, Antonn Steinhauser and Petr Tma February 4, 2015 Charles University in Prague Motivation: Choosing a Plotting Library We need


slide-1
SLIDE 1

Utilizing Performance Unit Tests To Increase Performance Awareness

Vojtěch Horký, Peter Libič, Lukáš Marek, Antonín Steinhauser and Petr Tůma February 4, 2015

Charles University in Prague

slide-2
SLIDE 2

Motivation: Choosing a Plotting Library

We need to plot graphs for our web application in Java. Our choice is driven by various requirements. – Available features – Price – Sane and documented API – Performance – . . .

slide-3
SLIDE 3

Motivation: Choosing a Plotting Library

We need to plot graphs for our web application in Java. Our choice is driven by various requirements. – Available features – Price – Sane and documented API – Performance – . . .

slide-4
SLIDE 4

Motivation: Choosing a Plotting Library Based on its Performance

2000 4000 6000 8000 10000 500 1000 1500 2000 2500 Comparison when plotting 800x600 PNG image Number of data points plotted Execution time [ms]

  • GRAL

XChart JFreeChart

slide-5
SLIDE 5

Issues With Low-Impact Performance Decisions

To decide which of the libraries is faster we had to – design and implement a test – and evaluate the results.

slide-6
SLIDE 6

Issues With Low-Impact Performance Decisions

To decide which of the libraries is faster we had to – design and implement a test – and evaluate the results. This takes time. Often, we – assume the performance differences are negligible – or fallback to previous experience with similar task.

slide-7
SLIDE 7

Our Goal

Help the developer with decisions that have low performance impact. – Without extra effort from the developer. – Give the answers as fast as possible. Make developers aware of the actual performance of their code. (We do not aim to correct bad architectural & design decisions.)

slide-8
SLIDE 8

The Idea: Extend API Documentation with Performance Information

Why API documentation?

– We target methods and classes. – Available even in IDE as context help.

slide-9
SLIDE 9

The Idea: Extend API Documentation with Performance Information

Why API documentation?

– We target methods and classes. – Available even in IDE as context help.

How it would be used?

When coding, developers would see the performance information together with the method detail.

slide-10
SLIDE 10

Tools: From JavaDoc . . .

slide-11
SLIDE 11

Tools: . . . to PerfJavaDoc

slide-12
SLIDE 12

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-13
SLIDE 13

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-14
SLIDE 14

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-15
SLIDE 15

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-16
SLIDE 16

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness Workload Generator

slide-17
SLIDE 17

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-18
SLIDE 18

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-19
SLIDE 19

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-20
SLIDE 20

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

slide-21
SLIDE 21

Getting Workloads from Performance Unit Tests

Performance Unit Test Workload Generator Workload Parameters Measurements Condition Evaluation Workload Test Condition Method Selection Method Under Test Test Harness

This provides data for the performance documentation.

slide-22
SLIDE 22

From Performance Unit Tests to Documentation

Connecting the workload to the method

void sort(long [] data) { ... }

slide-23
SLIDE 23

From Performance Unit Tests to Documentation

Connecting the workload to the method

@Workload("pkg.Workload.longArray") void sort(long [] data) { ... }

slide-24
SLIDE 24

From Performance Unit Tests to Documentation

Connecting the workload to the method

@Workload("pkg.Workload.longArray") void sort(long [] data) { ... } long[] longArray( int size) ... }

slide-25
SLIDE 25

From Performance Unit Tests to Documentation

Connecting the workload to the method

@Workload("pkg.Workload.longArray") void sort(long [] data) { ... }

Getting labels for the plots

long[] longArray( int size) ... }

slide-26
SLIDE 26

From Performance Unit Tests to Documentation

Connecting the workload to the method

@Workload("pkg.Workload.longArray") void sort(long [] data) { ... }

Getting labels for the plots

@Descr("Generate array filled with random longs") long[] longArray( int size) ... }

slide-27
SLIDE 27

From Performance Unit Tests to Documentation

Connecting the workload to the method

@Workload("pkg.Workload.longArray") void sort(long [] data) { ... }

Getting labels for the plots

@Descr("Generate array filled with random longs") long[] longArray(@Param("Array size") int size) ... }

slide-28
SLIDE 28

Displaying Performance Interactively

– Measure on demand – Cache & share the results – Refine results continuously (on background)

slide-29
SLIDE 29

Displaying Performance Interactively

– Measure on demand – Cache & share the results – Refine results continuously (on background)

  • 2000

6000 10000 20 40 60 80 100 120 140

After 1 second

  • 2000

6000 10000 20 40 60 80 100 120 140

After 5 seconds

  • 2000

6000 10000 20 40 60 80 100 120 140

After 5 minutes

Collection size Execution time [us]

slide-30
SLIDE 30

Experiment: Faster Applications with Extended Documentation

Volunteer students (advanced course of Java). – Groups with and without performance documentation. – Task to solve with Java JDOM library.

slide-31
SLIDE 31

Experiment: Faster Applications with Extended Documentation

Volunteer students (advanced course of Java). – Groups with and without performance documentation. – Task to solve with Java JDOM library.

Results

Participants have problems judging performance of their own code: expected run-times differed in orders of magnitude. Not feasible to decide whether one group writes faster applications (we would need thousands of students to have statistically reliable comparison of the groups).

slide-32
SLIDE 32

Experiment: Improve Existing Applications

Simulate developers caring about performance. Use similar – but faster – methods guided by results from the extended documentation.

slide-33
SLIDE 33

Experiment: Improve Existing Applications

Simulate developers caring about performance. Use similar – but faster – methods guided by results from the extended documentation.

Applications

– Buildhealth

– Reports merged results from various test frameworks.

– METS Downloader

– Gathers bibliographic meta-information.

(Selected because of a reasonable size and use of JDOM.)

slide-34
SLIDE 34

Improving Existing Applications: Results

Application Before After Buildhealth METS downloader

slide-35
SLIDE 35

Improving Existing Applications: Results

Application Before After Buildhealth Changed code METS downloader

slide-36
SLIDE 36

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms METS downloader

slide-37
SLIDE 37

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms Whole application METS downloader

slide-38
SLIDE 38

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms Whole application 2.52 s 2.40 s METS downloader

slide-39
SLIDE 39

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms Whole application 2.52 s 2.40 s METS downloader Changed code

slide-40
SLIDE 40

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms Whole application 2.52 s 2.40 s METS downloader Changed code 131.5 ms 27.4 ms

slide-41
SLIDE 41

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms Whole application 2.52 s 2.40 s METS downloader Changed code 131.5 ms 27.4 ms Whole application

slide-42
SLIDE 42

Improving Existing Applications: Results

Application Before After Buildhealth Changed code 938.3 ms 908.4 ms Whole application 2.52 s 2.40 s METS downloader Changed code 131.5 ms 27.4 ms Whole application 120.2 s 120.4 s

slide-43
SLIDE 43

Conclusion: Utilizing Performance Unit Tests To Increase Performance Awareness

Extend the API documentation and make the developers aware of performance of small parts of the code and help them write faster applications.

http://d3s.mff.cuni.cz/software/spl

slide-44
SLIDE 44

Conclusion: Utilizing Performance Unit Tests To Increase Performance Awareness

Extend the API documentation and make the developers aware of performance of small parts of the code and help them write faster applications.

http://d3s.mff.cuni.cz/software/spl

Thank You!