diff --git a/.github/workflows/web-perf.yml b/.github/workflows/web-perf.yml index 8a4e2a4f..55a00d14 100644 --- a/.github/workflows/web-perf.yml +++ b/.github/workflows/web-perf.yml @@ -28,9 +28,8 @@ jobs: node-version: [ lts/* ] include: - node-version: lts/* - num_test_iterations: 5 - init_performance_threshold_sec: 5 - proc_performance_threshold_sec: 15 + num_test_iterations: 10 + proc_performance_threshold_sec: 10 steps: - uses: actions/checkout@v3 @@ -56,4 +55,4 @@ jobs: run: yarn setup-test - name: Test - run: yarn test-perf --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},NUM_TEST_ITERATIONS=${{matrix.num_test_iterations}},INIT_PERFORMANCE_THRESHOLD_SEC=${{matrix.init_performance_threshold_sec}},PROC_PERFORMANCE_THRESHOLD_SEC=${{matrix.proc_performance_threshold_sec}} + run: yarn test-perf --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},NUM_TEST_ITERATIONS=${{matrix.num_test_iterations}},PROC_PERFORMANCE_THRESHOLD_SEC=${{matrix.proc_performance_threshold_sec}} diff --git a/binding/web/cypress.config.ts b/binding/web/cypress.config.ts index 6ca59d18..95dea01a 100644 --- a/binding/web/cypress.config.ts +++ b/binding/web/cypress.config.ts @@ -2,9 +2,8 @@ import { defineConfig } from 'cypress'; export default defineConfig({ env: { - 'NUM_TEST_ITERATIONS': 5, - 'INIT_PERFORMANCE_THRESHOLD_SEC': 3, - 'PROC_PERFORMANCE_THRESHOLD_SEC': 5, + 'NUM_TEST_ITERATIONS': 10, + 'PROC_PERFORMANCE_THRESHOLD_SEC': 10, }, e2e: { defaultCommandTimeout: 30000, diff --git a/binding/web/test/orca_perf.test.ts b/binding/web/test/orca_perf.test.ts index 7c251cd3..fbc793f9 100644 --- a/binding/web/test/orca_perf.test.ts +++ b/binding/web/test/orca_perf.test.ts @@ -3,7 +3,6 @@ import testData from '../cypress/fixtures/.test/test_data.json'; const ACCESS_KEY = Cypress.env('ACCESS_KEY'); const NUM_TEST_ITERATIONS = Number(Cypress.env('NUM_TEST_ITERATIONS')); -const INIT_PERFORMANCE_THRESHOLD_SEC = Number(Cypress.env('INIT_PERFORMANCE_THRESHOLD_SEC')); const PROC_PERFORMANCE_THRESHOLD_SEC = Number(Cypress.env('PROC_PERFORMANCE_THRESHOLD_SEC')); async function testPerformance( @@ -11,13 +10,11 @@ async function testPerformance( publicPath: string, text: string, ) { - const initPerfResults: number[] = []; const procPerfResults: number[] = []; for (let j = 0; j < NUM_TEST_ITERATIONS; j++) { let isSynthesized = false; - let start = Date.now(); const orca = await instance.create( ACCESS_KEY, orcaTranscript => { @@ -27,8 +24,6 @@ async function testPerformance( }, { publicPath: publicPath, forceWrite: true }, ); - let end = Date.now(); - initPerfResults.push((end - start) / 1000); const waitUntil = (): Promise => new Promise(resolve => { @@ -39,10 +34,10 @@ async function testPerformance( }, 100); }); - start = Date.now(); + let start = Date.now(); await orca.synthesize(text); await waitUntil(); - end = Date.now(); + let end = Date.now(); procPerfResults.push((end - start) / 1000); if (orca instanceof OrcaWorker) { @@ -52,15 +47,11 @@ async function testPerformance( } } - const initAvgPerf = initPerfResults.reduce((a, b) => a + b) / NUM_TEST_ITERATIONS; const procAvgPerf = procPerfResults.reduce((a, b) => a + b) / NUM_TEST_ITERATIONS; - // eslint-disable-next-line no-console - console.log(`Average init performance: ${initAvgPerf} seconds`); // eslint-disable-next-line no-console console.log(`Average proc performance: ${procAvgPerf} seconds`); - expect(initAvgPerf).to.be.lessThan(INIT_PERFORMANCE_THRESHOLD_SEC); expect(procAvgPerf).to.be.lessThan(PROC_PERFORMANCE_THRESHOLD_SEC); }