Skip to content

Commit

Permalink
Repair benchmarks (#3347)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher authored Oct 8, 2024
1 parent 0172277 commit db7e736
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 19 deletions.
1 change: 1 addition & 0 deletions packages/build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"files": [
"register-node-globals.mjs",
"tsup.config.library.ts",
"tsup.config.package.ts"
],
Expand Down
4 changes: 4 additions & 0 deletions packages/build-scripts/register-node-globals.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
globalThis.__DEV__ = false;
globalThis.__BROWSER = false;
globalThis.__NODEJS__ = true;
globalThis.__REACTNATIVE__ = false;
2 changes: 1 addition & 1 deletion packages/codecs-core/src/__benchmarks__/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S pnpm dlx tsx
#!/usr/bin/env -S pnpm dlx tsx -r ../build-scripts/register-node-globals.cjs

import { webcrypto as crypto } from 'node:crypto';

Expand Down
2 changes: 1 addition & 1 deletion packages/codecs-strings/src/__benchmarks__/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S pnpm dlx tsx
#!/usr/bin/env -S pnpm dlx tsx -r ../build-scripts/register-node-globals.cjs

import { webcrypto as crypto } from 'node:crypto';

Expand Down
2 changes: 1 addition & 1 deletion packages/fetch-impl/src/__benchmarks__/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S pnpm dlx tsx
#!/usr/bin/env -S pnpm dlx tsx -r ../build-scripts/register-node-globals.cjs

import { ok } from 'node:assert';
import process from 'node:process';
Expand Down
9 changes: 1 addition & 8 deletions packages/keys/src/__benchmarks__/run.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#!/usr/bin/env -S pnpm dlx tsx --
#!/usr/bin/env -S pnpm dlx tsx -r ../build-scripts/register-node-globals.cjs

import { Bench } from 'tinybench';

import { generateKeyPair, SignatureBytes, signBytes, verifySignature } from '../index';

Object.assign(globalThis, {
__BROWSER__: false,
__DEV__: false,
__NODEJS__: true,
__REACTNATIVE____: false,
});

const bench = new Bench({
throws: true,
});
Expand Down
9 changes: 1 addition & 8 deletions packages/rpc-transport-http/src/__benchmarks__/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env -S pnpm dlx tsx --
#!/usr/bin/env -S pnpm dlx tsx -r ../build-scripts/register-node-globals.cjs

import { ok } from 'node:assert';

Expand All @@ -15,13 +15,6 @@ ok(
);
VALIDATOR_URL ??= 'http://127.0.0.1:8899';

Object.assign(globalThis, {
__BROWSER__: false,
__DEV__: false,
__NODEJS__: true,
__REACTNATIVE____: false,
});

const NUM_CONCURRENT_REQUESTS = 1024;

const bench = new Bench({
Expand Down

0 comments on commit db7e736

Please sign in to comment.