From c8f283c9254f4a412031622a738332120f488cf7 Mon Sep 17 00:00:00 2001 From: "matteo.pietro.dazzi" Date: Fri, 21 Jun 2024 06:27:00 +0000 Subject: [PATCH] fix: map-filter-reduce --- benchmarks/map-filter-reduce.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/benchmarks/map-filter-reduce.test.ts b/benchmarks/map-filter-reduce.test.ts index 12a441c..5a524dc 100644 --- a/benchmarks/map-filter-reduce.test.ts +++ b/benchmarks/map-filter-reduce.test.ts @@ -11,18 +11,23 @@ describe("map-filter-reduce", () => { const initialArray = new Array(10_000).fill(0).map((_, index) => index); bench("normal", () => { - initialArray + const result = initialArray .map((value) => value * 2) .filter((value) => value % 2 === 0) .reduce((accumulator, value) => accumulator + value, 0); }); bench("re-flusso", async () => { + let result: number; + await pipeline( fromIterable(initialArray), map((value) => value * 2), filter((value) => value % 2 === 0), sum(), + forEach((sumResult) => { + result = sumResult; + }), ); }); });