Skip to content

Commit

Permalink
add benchmark github actions workflow, run and report tachometer fast…
Browse files Browse the repository at this point in the history
…-element benchmarks on pr
  • Loading branch information
Wendy authored and Wendy committed May 16, 2022
1 parent b96276d commit a57a727
Show file tree
Hide file tree
Showing 13 changed files with 816 additions and 70 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/ci-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Fast Element benchmark jobs

on: [pull_request]

jobs:
# If you'd like a message to appear in existing results comment that the
# benchmarks are current running and the shown results are out of date, run a
# job before the benchmarks with the initialize option set to true.
setup:
name: Setup Tachometer Reporting
runs-on: ubuntu-latest
steps:
- name: Initialize tachometer comment
uses: andrewiggins/tachometer-reporter-action@v2
with:
initialize: true
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo '::set-output name=dir::$(yarn cache dir)'

- name: Set up node_modules cache
uses: actions/cache@v2
id: yarn-cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
*/*/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install package dependencies
run: yarn install --frozen-lockfile --ignore-scripts --prefer-offline
- name: Prepare workspaces
run: yarn prepare

create10k:
name: Run create 10k items benchmark
needs: [setup]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "16.x"
- run: yarn install --frozen-lockfile --ignore-scripts --prefer-offline
# Run benchmarks. Ensure each job's results file has a unique name
- name: Run tachometer
run: |
cd packages/utilities/fast-benchmarks
yarn install
yarn run benchmark:fast-element:create10k
# Upload this benchmarks results
- name: Upload results
uses: actions/upload-artifact@v2
with:
name: results
path: packages/utilities/fast-benchmarks/results/fast-element_test-create10k.json

update10th:
name: Run update 10th element benchmark
needs: [setup]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Run tachometer and generate results file
run: |
cd packages/utilities/fast-benchmarks
yarn install
yarn run benchmark:fast-element:update10th
# Upload this benchmarks results
- name: Upload results
uses: actions/upload-artifact@v2
with:
name: results
path: packages/utilities/fast-benchmarks/results/fast-element_test-update10th.json

report_results:
name: Report Results
needs: [create10k, update10th]
runs-on: ubuntu-latest
steps:
# Download the results artifact
- uses: actions/download-artifact@v2
with:
name: results
path: packages/utilities/fast-benchmarks/results

# Read all the results and post comment
- name: Report Tachometer Result
uses: andrewiggins/tachometer-reporter-action@v2
with:
name: results
path: packages/utilities/fast-benchmarks/results/*.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "run workflow on any push",
"packageName": "fast-benchmarks",
"email": "email not defined",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { data, RandomItem } from "../../../utils/index.js";
name: "x-item",
template: html<XItem>`
<div @click="${x => x.onClick}" class="item">
${x => x.value}
${(x: XItem) => x.value}
</div>
`,
styles: css`
Expand All @@ -36,7 +36,7 @@ class XItem extends FASTElement {
${repeat(
x => x.items,
html`
<x-item :value="${x => x.label}"></x-item>
<x-item :value="${(x: RandomItem) => x.label}"></x-item>
`
)}
</div>
Expand Down
15 changes: 8 additions & 7 deletions packages/utilities/fast-benchmarks/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"name": "fast-benchmarks",
"version": "1.0.0",
"description": "",
"description": "utility library benchmarking for FAST libraries",
"type": "module",
"scripts": {
"build": "tsc && tsc --build",
"benchmark": "node scripts/index.js",
"help": "node ./scripts/index.js --help",
"benchmark:binding": "tach --config benchmarks/fast-element/binding/tachometer.json",
"debug:binding": "tach --config fast-element/binding/tachometer.json --manual"
"benchmark:binding": "tach --config examples/fast-element/binding/tachometer.json",
"debug:binding": "tach --config fast-element/binding/tachometer.json --manual",
"benchmark:fast-element:create10k": "yarn run benchmark --library=fast-element --benchmark=test --versions 1.6.0 1.10.1 --operations=create10k",
"benchmark:fast-element:update10th": "yarn run benchmark --library=fast-element --benchmark=test --versions 1.6.0 1.10.1 --operations=update10th"
},
"author": "Microsoft",
"license": "ISC",
"dependencies": {
"@microsoft/fast-element": "file:../../web-components/fast-element",
"@microsoft/fast-foundation": "^2.45.0",
"@microsoft/fast-element": "1.10.1",
"tachometer": "^0.5.10"
},
"devDependencies": {
"chalk": "^5.0.1",
"chromedriver": "^99.0.0",
"chromedriver": "^101.0.0",
"commander": "^9.2.0",
"cross-spawn": "^7.0.3",
"typescript": "^4.3.5"
"typescript": "^4.6.2"
}
}
Loading

0 comments on commit a57a727

Please sign in to comment.