Files
effect/scratchpad/test.ts
T
2024-12-28 21:04:45 +13:00

19 lines
575 B
TypeScript

import * as Arr from "effect/Array"
import * as Channel from "effect/Channel"
import * as Effect from "effect/Effect"
const channel = Channel.fromIterable(Arr.range(1, 10_000)).pipe(
Channel.mapEffect((i) => Effect.succeed(i + 1), { concurrency: "unbounded" }),
Channel.mapEffect((i) => Effect.succeed(i + 1), { concurrency: "unbounded" }),
Channel.mapEffect((i) => Effect.succeed(i + 1), { concurrency: "unbounded" })
)
Channel.runDrain(channel).pipe(Effect.runSync)
console.time("smol")
channel.pipe(
Channel.runDrain,
Effect.runSync
)
console.timeEnd("smol")