Skip to content

Commit

Permalink
Create a test harness for benchmarking different integration examples
Browse files Browse the repository at this point in the history
**Why?** Establish a baseline for how farmOS-map performs with the
current 1.x build. This will make it possible to tell whether
proposed future changes make farmOS-map's performance better or worse.

```sh
$ npm test

> [email protected] test
> rm -rf **/perfData/* && jest test/index.spec.js --maxWorkers=1

 PASS  test/index.spec.js (424.522 s)
  simple-html-consumer
    ✓ should build (4376 ms)
    get metrics from 10 perf.test.js runs
      ✓ simple-html-consumer run #0 (42571 ms)
      ✓ simple-html-consumer run #1 (41699 ms)
      ✓ simple-html-consumer run farmOS#2 (42825 ms)
      ✓ simple-html-consumer run farmOS#3 (41734 ms)
      ✓ simple-html-consumer run farmOS#4 (41481 ms)
      ✓ simple-html-consumer run farmOS#5 (41468 ms)
      ✓ simple-html-consumer run farmOS#6 (41777 ms)
      ✓ simple-html-consumer run farmOS#7 (42746 ms)
      ✓ simple-html-consumer run farmOS#8 (42038 ms)
      ✓ simple-html-consumer run farmOS#9 (41514 ms)

  console.log
    {
      'simple-html-consumer/DSL-cached': {
        'first-contentful-paint': 140.77000000476838,
        'nav-to-net-idle': 1031.2737506866456,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 0,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/SlowCPU-uncached': {
        'first-contentful-paint': 726.1599999904632,
        'nav-to-net-idle': 2035.0393460512162,
        'js-resource-count': 7.1,
        'js-resource-total-transfer-bytes': 147957,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/SlowCPU-cached': {
        'first-contentful-paint': 761.460000038147,
        'nav-to-net-idle': 2054.859950900078,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 0,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/Unthrottled-uncached': {
        'first-contentful-paint': 393.66999995708466,
        'nav-to-net-idle': 1427.9229674577714,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 147957,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/Unthrottled-cached': {
        'first-contentful-paint': 158.37000000476837,
        'nav-to-net-idle': 1033.3836732149125,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 0,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/Regular4G-cached': {
        'first-contentful-paint': 158.9699999809265,
        'nav-to-net-idle': 1004.0716405630112,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 0,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/Regular4G-uncached': {
        'first-contentful-paint': 572.5700000047684,
        'nav-to-net-idle': 1704.80444521904,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 147957,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/DSL-uncached': {
        'first-contentful-paint': 895.1700000524521,
        'nav-to-net-idle': 2440.2575431108476,
        'js-resource-count': 7.1,
        'js-resource-total-transfer-bytes': 147957,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/Regular2G-cached': {
        'first-contentful-paint': 152.9400000333786,
        'nav-to-net-idle': 1437.0032620191573,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 0,
        'js-resource-total-decoded-bytes': 579733
      },
      'simple-html-consumer/Regular2G-uncached': {
        'first-contentful-paint': 6737.32999997139,
        'nav-to-net-idle': 14372.921477985383,
        'js-resource-count': 7,
        'js-resource-total-transfer-bytes': 147957,
        'js-resource-total-decoded-bytes': 579733
      }
    }

      at Object.<anonymous> (test/index.spec.js:76:11)

Test Suites: 1 passed, 1 total
Tests:       11 passed, 11 total
Snapshots:   0 total
Time:        424.909 s, estimated 521 s
Ran all test suites matching /test\/index.spec.js/i.
```
  • Loading branch information
symbioquine committed May 22, 2021
1 parent c7afb26 commit 8ae9014
Show file tree
Hide file tree
Showing 20 changed files with 54,597 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/dist/
/node_modules/
dist
node_modules
perfData
41 changes: 41 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
This directory includes demo projects which can be used to profile the performance differences between different ways of using farmOS-map.

## Getting started

Run `npm install` in each example project;

```sh
npm run install-all
```

Run 10 iterations of a performance test against each example project and report the results;

```sh
npm test
```

### Individual examples

e.g.

```sh
cd simple-html-consumer/
```

Build;

```sh
npm run build
```

Run a single iteration of a performance test and report the results;

```sh
npm test
```

Run a production-like server from the dist directory;

```sh
npm run serve-dist
```
5 changes: 5 additions & 0 deletions examples/lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "0.0.0",
"npmClient": "npm",
"useWorkspaces": true
}
Loading

0 comments on commit 8ae9014

Please sign in to comment.