From d73381e00b5109505a15b10512e52d17b4b78dd6 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Wed, 23 Nov 2022 14:57:21 +0000 Subject: [PATCH] chore: update benchmark (#232) Refactors benchmark to use exported factory function instead of instantiating an instance of the class which is no longer exported. --- benchmark/send-and-receive.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/benchmark/send-and-receive.js b/benchmark/send-and-receive.js index e65896fb41..cb247896c0 100644 --- a/benchmark/send-and-receive.js +++ b/benchmark/send-and-receive.js @@ -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 )