Conversation open speed benchmarking for staging builds

Co-authored-by: Fedor Indutnyy <indutny@signal.org>
This commit is contained in:
trevor-signal 2023-07-20 18:37:56 -04:00 committed by GitHub
parent 46c063b203
commit 82e058f2b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 338 additions and 66 deletions

View file

@ -5,7 +5,8 @@
import assert from 'assert';
import type { PrimaryDevice } from '@signalapp/mock-server';
import { Bootstrap, debug, stats, RUN_COUNT, DISCARD_COUNT } from './fixtures';
import { Bootstrap, debug, RUN_COUNT, DISCARD_COUNT } from './fixtures';
import { stats } from '../../util/benchmark/stats';
const CONVERSATION_SIZE = 1000; // messages
const DELAY = 50; // milliseconds

View file

@ -11,12 +11,6 @@ export const debug = createDebug('mock:benchmarks');
export { Bootstrap };
export { App } from '../playwright';
export type StatsType = {
mean: number;
stddev: number;
[key: string]: number;
};
export const RUN_COUNT = process.env.RUN_COUNT
? parseInt(process.env.RUN_COUNT, 10)
: 100;
@ -29,38 +23,6 @@ export const DISCARD_COUNT = process.env.DISCARD_COUNT
? parseInt(process.env.DISCARD_COUNT, 10)
: 5;
export function stats(
list: ReadonlyArray<number>,
percentiles: ReadonlyArray<number> = []
): StatsType {
if (list.length === 0) {
throw new Error('Empty list given to stats');
}
let mean = 0;
let stddev = 0;
for (const value of list) {
mean += value;
stddev += value ** 2;
}
mean /= list.length;
stddev /= list.length;
stddev -= mean ** 2;
stddev = Math.sqrt(stddev);
const sorted = list.slice().sort((a, b) => a - b);
const result: StatsType = { mean, stddev };
for (const p of percentiles) {
result[`p${p}`] = sorted[Math.floor((sorted.length * p) / 100)];
}
return result;
}
// Can happen if electron exits prematurely
process.on('unhandledRejection', reason => {
console.error('Unhandled rejection:');

View file

@ -13,11 +13,11 @@ import {
import {
Bootstrap,
debug,
stats,
RUN_COUNT,
GROUP_SIZE,
DISCARD_COUNT,
} from './fixtures';
import { stats } from '../../util/benchmark/stats';
const CONVERSATION_SIZE = 500; // messages
const LAST_MESSAGE = 'start sending messages now';

View file

@ -6,7 +6,8 @@ import assert from 'assert';
import { ReceiptType } from '@signalapp/mock-server';
import { Bootstrap, debug, stats, RUN_COUNT, DISCARD_COUNT } from './fixtures';
import { Bootstrap, debug, RUN_COUNT, DISCARD_COUNT } from './fixtures';
import { stats } from '../../util/benchmark/stats';
const CONVERSATION_SIZE = 500; // messages

View file

@ -4,7 +4,8 @@
import { ReceiptType } from '@signalapp/mock-server';
import { debug, Bootstrap, stats, RUN_COUNT } from './fixtures';
import { debug, Bootstrap, RUN_COUNT } from './fixtures';
import { stats } from '../../util/benchmark/stats';
const MESSAGE_BATCH_SIZE = 1000; // messages