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

Commit

Permalink
chore: update benchmark (#232)
Browse files Browse the repository at this point in the history
Refactors benchmark to use exported factory function instead of
instantiating an instance of the class which is no longer exported.
  • Loading branch information
achingbrain authored Nov 23, 2022
1 parent a153108 commit d73381e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions benchmark/send-and-receive.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@ import Benchmark from 'benchmark'
import { pipe } from 'it-pipe'
import { expect } from 'aegir/chai'
import { pushable } from 'it-pushable'
import { Mplex } from '../dist/src/index.js'
import { mplex } from '../dist/src/index.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'

const factory = new Mplex()
const factory = mplex()()
const muxer = factory.createStreamMuxer()
const stream1 = muxer.newStream('hello')
const muxer2 = factory.createStreamMuxer({
onIncomingStream: async (stream) => {
await pipe(
stream,
function transform (source) {
return (async function * () { // A generator is async iterable
for await (const chunk of source) {
yield chunk
}
})()
async function * transform (source) { // A generator is async iterable
for await (const chunk of source) {
yield chunk
}
},
stream
)
Expand Down

0 comments on commit d73381e

Please sign in to comment.