PolymerLabs/polyperf

Name: polyperf

Owner: PolymerLabs

Description: Simple webpage performance testing harness

Created: 2016-01-04 01:04:49.0

Updated: 2018-03-22 19:14:46.0

Pushed: 2017-01-11 22:41:57.0

Homepage: null

Size: 382

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

polyperf

polyperf is a simple performance testing harness. It loads a series of target pages (each in their own iframe) a configurable number of times, and displays the successive run times, as well as the overall minimum.

Installing and running

Run

r install
serve

Then navigate to http://localhost:8080/components/polyperf/sample/runner.html. The results will look something like this:

screen shot 2016-11-03 at 12 54 32

The tests are run by runner.html, which defines the list of tests to run. Edit runner.html to choose test pages to run, and how many times each test should be run. By default, each test runs 25 times, but you can configure it by changing the frame-tester's runs attribute:

me-tester runs="25"></frame-tester>

There are two different ways to configure your tests:

Using the harness

Use this approach if you want to test the cost of an element by repeating it a number of times on the page (by default: 250 times).

In runner.html, modify the array of tests in document.querySelector('frame-tester').tests as follows:

ment.querySelector('frame-tester').tests = [
arness.html?wc-element=input',
arness.html?wc-element=test1-element&wc-path=./elements/test1-element.html',
arness.html?wc-element=test2-element&wc-path=./elements/test2-element.html'

To test a native element (eg. input), use wc-element=input. To test a custom element, use harness.html?wc-element=$name&wc-path=$path, where $name is the name of the custom element (eg. paper-input), and $path is the path to where it lives (eg. ./elements/paper-input/paper-input.html).

To configure the number of times the element is repeated in the page, use the wc-count argument: harness.html?wc-element=$name&wc-path=$path&wc-count=17

Note, the reported results are cummulative, i.e. how long the page with the repeated element took to run.

Using specific tests

Use this approach if you want to repeat a custom test that does something more than just repeating an element in a page.

In runner.html, modify the array of tests in document.querySelector('frame-tester').tests as follows:

ment.querySelector('frame-tester').tests = [
est1.html',
est2.html'

Where test.1.html is the specific webpage to test. Each test page should include

ipt src="perf-lib/perf.js"></script>

and call

ipt>
nsole.perf();
ript>

before the snippet of code to test, followed by

ipt>
onsole.perfEnd();
ript>

after the snippet of code to test.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.