Skip to content

Commit

Permalink
feat: benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ilteoood committed Jun 21, 2024
1 parent 7252cfa commit 6de6a41
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions benchmarks/map-filter-reduce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ import { forEach } from "../src/forEach";

describe("map-filter-reduce", () => {
const initialArray = new Array(10_000).fill(0).map((_, index) => index);
const expectedResult = 99_990_000;

bench("normal", () => {
const result = initialArray
initialArray
.map((value) => value * 2)
.filter((value) => value % 2 === 0)
.reduce((accumulator, value) => accumulator + value, 0);
});

bench("re-flusso", () => {
bench("re-flusso", async () => {
let result = 0;

pipeline(
await pipeline(
fromIterable(initialArray),
map((value) => value * 2),
filter((value) => value % 2 === 0),
Expand Down

0 comments on commit 6de6a41

Please sign in to comment.