mirror of
https://github.com/Effect-TS/effect.git
synced 2026-12-03 03:25:40 +08:00
19 lines
575 B
TypeScript
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")
|