-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sm/perf-metrics' into sm/new-logger
- Loading branch information
Showing
6 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# runs some very-large-repo tests (for windows filesystem limits) and commits perf results for comparison | ||
name: perf-tests | ||
on: | ||
push: | ||
branches-ignore: [main] | ||
workflow_dispatch: | ||
|
||
# linux will finish ahead of windows, but prevent other branches/commits from hitting simultaneously | ||
# since we're pushing git commits and there would be conflicts | ||
concurrency: perf-test | ||
|
||
jobs: | ||
perf-tests: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: yarn | ||
- run: yarn install | ||
- name: Download previous benchmark data | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
- run: npm run test:perf | tee test/perf/output.txt | ||
|
||
# Run `github-action-benchmark` action | ||
- name: Store benchmark result | ||
uses: benchmark-action/github-action-benchmark@5bbce78ef18edf5b96cb2d23e8d240b485f9dc4a | ||
with: | ||
name: Logger Benchmarks - ${{ matrix.os }} | ||
tool: 'benchmarkjs' | ||
output-file-path: test/perf/output.txt | ||
comment-on-alert: true | ||
fail-on-alert: true | ||
# Push and deploy GitHub pages branch automatically | ||
# this has a bug where it creates duplicate commits when summary-always and aut-push are both true | ||
# summary-always: true | ||
comment-always: true | ||
benchmark-data-dir-path: perf-${{ runner.os}} | ||
auto-push: true | ||
github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2023, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
import { Suite } from 'benchmark'; | ||
import { Logger } from '../../../src/exported'; | ||
|
||
const suite = new Suite(); | ||
|
||
const logger = new Logger('Benchmarks'); | ||
|
||
// add tests | ||
suite | ||
.add('Child logger creation', () => { | ||
// eslint-disable-next-line @typescript-eslint/prefer-includes | ||
Logger.childFromRoot('benchmarkChild'); | ||
}) | ||
.add('Logging a string on root logger', () => { | ||
logger.debug('this is a string'); | ||
}) | ||
.add('Logging an object on root logger', () => { | ||
logger.debug({ foo: 1, bar: 2, baz: 3 }); | ||
}) | ||
.add('Logging an object with a message on root logger', () => { | ||
logger.debug({ foo: 1, bar: 2, baz: 3 }, 'this is a message'); | ||
}) | ||
.add('Logging an object with a redacted prop on root logger', () => { | ||
logger.debug({ foo: 1, bar: 2, accessToken: '00D' }); | ||
}) | ||
.add('Logging a nested 3-level object on root logger', () => { | ||
logger.debug({ foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: { foo: 1, bar: 2, baz: 3 } } }); | ||
}) | ||
// add listeners | ||
.on('cycle', (event: any) => { | ||
// eslint-disable-next-line no-console, @typescript-eslint/no-unsafe-member-access | ||
console.log(String(event.target)); | ||
}) | ||
.run({ async: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters