Updated Benchmarking your changes (markdown)
parent
e81e9207c1
commit
3eacca6bee
@ -1,32 +1,39 @@
|
|||||||
When working on issues related to performance, it is important to provide a performance benchmark for your changes to assess whether or not your change has a performance impact. PDF.js provides tools to do this easily. Normally you would create a simple manifest file has couple of pdfs you trying to optimize and run it multiple times, e.g. `my_pdfs.json`:
|
When working on issues related to performance, it is important to provide a performance benchmark for your changes to assess whether or not your change has a performance impact. PDF.js provides tools to do this easily. Normally you would create a simple manifest file has a couple of PDF files you're trying to optimize and run it multiple times, e.g. `benchmark.json`:
|
||||||
|
|
||||||
```
|
```
|
||||||
[
|
[
|
||||||
{ "id": "tracemonkey-eq",
|
{
|
||||||
"file": "pdfs/tracemonkey.pdf",
|
"id": "tracemonkey-eq",
|
||||||
"md5": "9a192d8b1a7dc652a19835f6f08098bd",
|
"file": "pdfs/tracemonkey.pdf",
|
||||||
"rounds": 20,
|
"md5": "9a192d8b1a7dc652a19835f6f08098bd",
|
||||||
"lastPage": 5,
|
"rounds": 20,
|
||||||
"type": "load"
|
"lastPage": 5,
|
||||||
}
|
"type": "load"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the following command to create a 'baseline' measurement (before you make your changes):
|
Run the following commands to create a 'baseline' measurement (i.e., before you make your changes):
|
||||||
|
|
||||||
|
$ git checkout master
|
||||||
|
$ gulp generic
|
||||||
$ cd test
|
$ cd test
|
||||||
$ node test.js --browserManifestFile=resources/browser_manifests/browser_manifest.json \
|
$ node test.js --browserManifestFile=resources/browser_manifests/browser_manifest.json \
|
||||||
--statsFile=stats/results/baseline.json --statsDelay=5000 \
|
--statsFile=stats/results/baseline.json --statsDelay=5000 \
|
||||||
--manifestFile=my_pdfs.json
|
--manifestFile=benchmark.json
|
||||||
|
|
||||||
Then apply your changes and create a 'current' measurement:
|
Then apply your changes and create a 'current' measurement (replace `<feature-branch>` with the name of your branch):
|
||||||
|
|
||||||
|
$ cd ..
|
||||||
|
$ git checkout <feature-branch>
|
||||||
|
$ gulp generic
|
||||||
|
$ cd test
|
||||||
$ node test.js --browserManifestFile=resources/browser_manifests/browser_manifest.json \
|
$ node test.js --browserManifestFile=resources/browser_manifests/browser_manifest.json \
|
||||||
--statsFile=stats/results/current.json --statsDelay=5000 \
|
--statsFile=stats/results/current.json --statsDelay=5000 \
|
||||||
--manifestFile=my_pdfs.json
|
--manifestFile=benchmark.json
|
||||||
|
|
||||||
Now you can compare the measurements and see any performance differences:
|
Finally, you can compare the measurements and see any performance differences:
|
||||||
|
|
||||||
node stats/statcmp.js stats/results/baseline.json stats/results/current.json
|
$ node stats/statcmp.js stats/results/baseline.json stats/results/current.json
|
||||||
|
|
||||||
As a sanity check, you should do this twice with the same code and compare the results.
|
As a sanity check, you should do this twice with the same code and compare the results.
|
||||||
Loading…
x
Reference in New Issue
Block a user