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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
Run
r install
serve
Then navigate to http://localhost:8080/components/polyperf/sample/runner.html. The results will look something like this:
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:
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.
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.