Files
common/packages/util-crypto/src/test/performance.ts
T
Jaco 3db2990ce7 Change Date.now() to performance.now() (#1551)
* Change Date.now() to performance.now()

* Adjust
2022-06-20 11:29:59 +03:00

18 lines
583 B
TypeScript

// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { arrayRange } from '@polkadot/util';
import { perf, perfCmp } from '@polkadot/util/test/performance';
import { randomAsU8a } from '..';
type ExecFn = (input: Uint8Array, onlyJs: boolean) => unknown;
const GENERATED = arrayRange(256).map(() => [randomAsU8a()]);
export function performanceWasm (name: string, count: number, exec: ExecFn, inputs = GENERATED): void {
perfCmp(name, ['WebAssembly', 'JavaScript'], count, inputs, exec);
}
export { perf, perfCmp };