File tree Expand file tree Collapse file tree 5 files changed +93
-12
lines changed
Expand file tree Collapse file tree 5 files changed +93
-12
lines changed Original file line number Diff line number Diff line change 1+ name : " Benchmark"
2+ on :
3+ push :
4+ workflow_call :
5+ workflow_dispatch :
6+ jobs :
7+ bench :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v2.3.4
11+ - uses : ./.github/actions/setup-test-env
12+ - name : Run benchmarks
13+ uses : CodSpeedHQ/action@v1
14+ with :
15+ run : pnpm x bench/all.ts
16+ token : ${{ secrets.CODSPEED_TOKEN }}
Original file line number Diff line number Diff line change 2121 shell : bash
2222 run : pnpm lint
2323
24- bench :
25- runs-on : ubuntu-latest
26- steps :
27- - uses : actions/checkout@v2.3.4
28- - uses : ./.github/actions/setup-test-env
29- - name : Run benchmarks
30- shell : bash
31- run : pnpm x bench/all.ts
32-
3324 build-js :
3425 runs-on : ubuntu-latest
3526 steps :
Original file line number Diff line number Diff line change 11import { Suite } from "benchmark" ;
2+ import { withCodSpeed } from "@codspeed/benchmark.js-plugin" ;
23import findRoot from "find-root" ;
34import fs from "fs" ;
45import { LargeRoot } from "../spec/fixtures/LargeRoot" ;
56import { FruitAisle } from "../spec/fixtures/FruitAisle" ;
67import { TestClassModel } from "../spec/fixtures/TestClassModel" ;
7- import { TestModelSnapshot } from "../spec/fixtures/TestModel" ;
8+ import { BigTestModelSnapshot , TestModelSnapshot } from "../spec/fixtures/TestModel" ;
89
910const root = findRoot ( __dirname ) ;
1011const largeRoot = JSON . parse ( fs . readFileSync ( root + "/spec/fixtures/large-root-snapshot.json" , "utf8" ) ) ;
1112const fruitAisle = JSON . parse ( fs . readFileSync ( root + "/spec/fixtures/fruit-aisle-snapshot.json" , "utf8" ) ) ;
12- const suite = new Suite ( "instantiating model classes" ) ;
13+ const suite = withCodSpeed ( new Suite ( "instantiating model classes" ) ) ;
1314
14- suite
15+ void suite
1516 . add ( "instantiating a small root" , function ( ) {
1617 TestClassModel . createReadOnly ( TestModelSnapshot ) ;
1718 } )
2122 . add ( "instantiating a large union" , function ( ) {
2223 FruitAisle . createReadOnly ( fruitAisle ) ;
2324 } )
25+ . add ( "instantiating a diverse root" , function ( ) {
26+ TestClassModel . createReadOnly ( BigTestModelSnapshot ) ;
27+ } )
2428 . on ( "start" , function ( ) {
2529 console . profile ( ) ;
2630 } )
Original file line number Diff line number Diff line change 3232 "reflect-metadata" : " ^0.1.13"
3333 },
3434 "devDependencies" : {
35+ "@codspeed/benchmark.js-plugin" : " ^2.2.0" ,
3536 "@faker-js/faker" : " ^7.6.0" ,
3637 "@gadgetinc/eslint-config" : " ^0.6.1" ,
3738 "@gadgetinc/prettier-config" : " ^0.4.0" ,
You can’t perform that action at this time.
0 commit comments