Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
chore: add benchmark script
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Aug 23, 2022
1 parent 27671e0 commit e7bfd39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"build": "aegir build",
"benchmark": "node ./node_modules/.bin/benchmark test/benchmark/benchmark.test.js",
"test": "aegir test",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import { pipe } from 'it-pipe'
import { expect } from 'aegir/chai'
import { itBench, setBenchOpts } from '@dapplion/benchmark'
import { Mplex } from '../dist/src/index.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { Mplex } from '../../dist/src/index.js'
import { pushable } from 'it-pushable'

const factory = new Mplex()
Expand All @@ -28,7 +27,9 @@ const muxer2 = factory.createStreamMuxer({
)
}
})

pipe(muxer, muxer2, muxer)

const p = pushable()
const promise = pipe(p, stream1, async function collect (source) {
const vals = []
Expand All @@ -38,8 +39,7 @@ const promise = pipe(p, stream1, async function collect (source) {
return vals
})

// const data = uint8ArrayFromString('this is a sample string')
// typical attestation
// typical data of ethereum consensus attestation
const data = Buffer.from(
'e40000000a000000000000000a00000000000000a45c8daa336e17a150300afd4c717313c84f291754c51a378f20958083c5fa070a00000000000000a45c8daa336e17a150300afd4c717313c84f291754c51a378f20958083c5fa070a00000000000000a45c8daa336e17a150300afd4c717313c84f291754c51a378f20958083c5fa0795d2ef8ae4e2b4d1e5b3d5ce47b518e3db2c8c4d082e4498805ac2a686c69f248761b78437db2927470c1e77ede9c18606110faacbcbe4f13052bde7f7eff6aab09edf7bc4929fda2230f943aba2c47b6f940d350cb20c76fad4a8d40e2f3f1f01',
'hex'
Expand Down

0 comments on commit e7bfd39

Please sign in to comment.