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

Commit d73381e

Browse files
authored
chore: update benchmark (#232)
Refactors benchmark to use exported factory function instead of instantiating an instance of the class which is no longer exported.
1 parent a153108 commit d73381e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

benchmark/send-and-receive.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,20 @@ import Benchmark from 'benchmark'
99
import { pipe } from 'it-pipe'
1010
import { expect } from 'aegir/chai'
1111
import { pushable } from 'it-pushable'
12-
import { Mplex } from '../dist/src/index.js'
12+
import { mplex } from '../dist/src/index.js'
1313
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
1414

15-
const factory = new Mplex()
15+
const factory = mplex()()
1616
const muxer = factory.createStreamMuxer()
1717
const stream1 = muxer.newStream('hello')
1818
const muxer2 = factory.createStreamMuxer({
1919
onIncomingStream: async (stream) => {
2020
await pipe(
2121
stream,
22-
function transform (source) {
23-
return (async function * () { // A generator is async iterable
24-
for await (const chunk of source) {
25-
yield chunk
26-
}
27-
})()
22+
async function * transform (source) { // A generator is async iterable
23+
for await (const chunk of source) {
24+
yield chunk
25+
}
2826
},
2927
stream
3028
)

0 commit comments

Comments
 (0)