Skip to content

Commit

Permalink
Addressing review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
shimkiv committed Mar 14, 2024
1 parent 6465c4e commit e43151e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
10 changes: 4 additions & 6 deletions benchmark/base-benchmark.ts → benchmark/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ function logResult(
console.log(result.label + `\n`);
console.log(`time: ${resultToString(result)}`);

if (!previousResult) {
return;
}
if (previousResult === undefined) return;

let change = (result.mean - previousResult.mean) / previousResult.mean;
let p = pValue(result, previousResult);
Expand Down Expand Up @@ -167,8 +165,8 @@ function pValue(sample1: BenchmarkResult, sample2: BenchmarkResult): number {
}

function calculateBounds(result: BenchmarkResult) {
const percentage = (Math.sqrt(result.variance) / result.mean) * 100;
const upperBound = result.mean + (result.mean * percentage) / 100;
const lowerBound = result.mean - (result.mean * percentage) / 100;
const stdDev = Math.sqrt(result.variance);
const upperBound = result.mean + stdDev;
const lowerBound = result.mean - stdDev;
return { upperBound, lowerBound };
}
4 changes: 2 additions & 2 deletions benchmark/samples/ecdsa.ts → benchmark/benchmarks/ecdsa.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* ECDSA benchmark sample
* ECDSA benchmark
*/

import { Provable } from 'o1js';
Expand All @@ -9,7 +9,7 @@ import {
Secp256k1,
keccakAndEcdsa,
} from '../../src/examples/crypto/ecdsa/ecdsa.js';
import { benchmark } from '../base-benchmark.js';
import { benchmark } from '../benchmark.js';

let privateKey = Secp256k1.Scalar.random();
let publicKey = Secp256k1.generator.scale(privateKey);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/runners/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* ```
*/

import { logResult } from '../base-benchmark.js';
import EcdsaBenchmark from '../samples/ecdsa.js';
import { logResult } from '../benchmark.js';
import EcdsaBenchmark from '../benchmarks/ecdsa.js';

// Run all benchmarks
const results = [...(await EcdsaBenchmark.run())];
Expand Down
4 changes: 2 additions & 2 deletions benchmark/runners/with-cloud-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* ```
*/

import { logResult } from '../base-benchmark.js';
import EcdsaBenchmark from '../samples/ecdsa.js';
import { logResult } from '../benchmark.js';
import EcdsaBenchmark from '../benchmarks/ecdsa.js';
import {
readPreviousResultFromInfluxDb,
writeResultToInfluxDb,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/utils/influxdb-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { InfluxDB, Point } from '@influxdata/influxdb-client';
import os from 'node:os';
import { BenchmarkResult, calculateBounds } from '../base-benchmark.js';
import { BenchmarkResult, calculateBounds } from '../benchmark.js';

const INFLUXDB_CLIENT_OPTIONS = {
url: process.env.INFLUXDB_URL,
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
},
"author": "O(1) Labs",
"devDependencies": {
"@influxdata/influxdb-client": "^1.33.2",
"@noble/hashes": "^1.3.2",
"@playwright/test": "^1.25.2",
"@types/isomorphic-fetch": "^0.0.36",
Expand All @@ -94,7 +95,6 @@
"typescript": "5.1"
},
"dependencies": {
"@influxdata/influxdb-client": "^1.33.2",
"blakejs": "1.2.1",
"cachedir": "^2.4.0",
"isomorphic-fetch": "^3.0.0",
Expand Down

0 comments on commit e43151e

Please sign in to comment.