Skip to content

feat: add Val{N} parameter to tee for N-way channel splitting#25

Merged
zsoerenm merged 1 commit into
mainfrom
ss/tee-val-n
Jan 23, 2026
Merged

feat: add Val{N} parameter to tee for N-way channel splitting#25
zsoerenm merged 1 commit into
mainfrom
ss/tee-val-n

Conversation

@zsoerenm

Copy link
Copy Markdown
Member

Add tee(Val{N}, in, channel_size) to split a channel into N synchronized outputs instead of just 2. The existing tee(in, channel_size) signature remains as backward-compatible shorthand for tee(Val(2), in, channel_size).

Add tee(Val{N}, in, channel_size) to split a channel into N synchronized
outputs instead of just 2. The existing tee(in, channel_size) signature
remains as backward-compatible shorthand for tee(Val(2), in, channel_size).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zsoerenm zsoerenm self-assigned this Jan 22, 2026
@codecov

codecov Bot commented Jan 22, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@github-actions

Copy link
Copy Markdown

Benchmark Results (Julia v1)

Time benchmarks
main 7513db7... main / 7513db7...
channel/buffer=1 3.93 ± 0.054 ms 3.98 ± 0.054 ms 0.986 ± 0.019
channel/buffer=1024 0.184 ± 0.018 ms 0.189 ± 0.017 ms 0.977 ± 0.13
channel/buffer=16 0.417 ± 0.014 ms 0.419 ± 0.0099 ms 0.995 ± 0.04
channel/buffer=256 0.206 ± 0.011 ms 0.2 ± 0.0071 ms 1.03 ± 0.065
channel/buffer=4 1.1 ± 0.022 ms 1.12 ± 0.02 ms 0.983 ± 0.027
channel/buffer=64 0.244 ± 0.0098 ms 0.252 ± 0.012 ms 0.969 ± 0.06
rechunk/10000_to_2048/buffer=1 6.94 ± 0.14 ms 6.8 ± 0.14 ms 1.02 ± 0.029
rechunk/10000_to_2048/buffer=16 4.74 ± 0.16 ms 4.65 ± 0.13 ms 1.02 ± 0.044
rechunk/10000_to_2048/buffer=4 4.99 ± 0.16 ms 4.98 ± 0.18 ms 1 ± 0.049
rechunk/10000_to_2048/buffer=64 4.72 ± 0.16 ms 4.7 ± 0.19 ms 1.01 ± 0.052
rechunk/2048_to_10000/buffer=1 1.1 ± 0.073 ms 1.07 ± 0.074 ms 1.03 ± 0.099
rechunk/2048_to_10000/buffer=16 1.18 ± 0.11 ms 1.12 ± 0.11 ms 1.05 ± 0.14
rechunk/2048_to_10000/buffer=4 1.14 ± 0.096 ms 1.09 ± 0.095 ms 1.05 ± 0.13
rechunk/2048_to_10000/buffer=64 1.38 ± 0.15 ms 1.37 ± 0.14 ms 1.01 ± 0.15
rechunk_state/batch/batch_2048_to_512_1ch 1.74 ± 0.15 ms 1.83 ± 0.15 ms 0.952 ± 0.11
rechunk_state/batch/batch_2048_to_512_4ch 6.75 ± 0.29 ms 6.9 ± 0.31 ms 0.979 ± 0.061
rechunk_state/batch/batch_512_to_2048_1ch 0.362 ± 0.041 ms 0.412 ± 0.047 ms 0.88 ± 0.14
rechunk_state/batch/batch_passthrough_2048_1ch 4.14 ± 0.55 μs 4.51 ± 0.49 μs 0.918 ± 0.16
rechunk_state/batch/iterative_2048_to_512_1ch 1.76 ± 0.13 ms 1.82 ± 0.14 ms 0.964 ± 0.1
rechunk_state/batch/iterative_2048_to_512_4ch 6.91 ± 0.18 ms 7.13 ± 0.3 ms 0.97 ± 0.048
rechunk_state/batch/iterative_512_to_2048_1ch 0.363 ± 0.042 ms 0.451 ± 0.044 ms 0.804 ± 0.12
rechunk_state/batch/iterative_passthrough_2048_1ch 4.11 ± 0.43 μs 4.56 ± 0.41 μs 0.901 ± 0.12
rechunk_state/channels/2048_to_1024_1ch 1.74 ± 0.14 ms 1.73 ± 0.1 ms 1.01 ± 0.099
rechunk_state/channels/2048_to_1024_2ch 3.44 ± 0.15 ms 3.4 ± 0.2 ms 1.01 ± 0.073
rechunk_state/channels/2048_to_1024_4ch 6.59 ± 0.2 ms 6.7 ± 0.27 ms 0.984 ± 0.05
rechunk_state/channels/2048_to_1024_8ch 13.3 ± 0.58 ms 13.1 ± 0.32 ms 1.01 ± 0.05
rechunk_state/downsample/10000_to_1024_1ch 8.07 ± 0.36 ms 8.29 ± 0.39 ms 0.973 ± 0.064
rechunk_state/downsample/2048_to_512_1ch 1.78 ± 0.18 ms 1.87 ± 0.15 ms 0.95 ± 0.12
rechunk_state/downsample/2048_to_512_4ch 6.87 ± 0.28 ms 6.91 ± 0.27 ms 0.995 ± 0.055
rechunk_state/passthrough/2048_to_2048_1ch 4.15 ± 0.46 μs 4.43 ± 0.45 μs 0.937 ± 0.14
rechunk_state/passthrough/2048_to_2048_4ch 4.81 ± 0.34 μs 4.89 ± 0.64 μs 0.984 ± 0.15
rechunk_state/types/ComplexF64_2048_to_1024 2.88 ± 0.2 ms 3.05 ± 0.26 ms 0.944 ± 0.1
rechunk_state/types/Float32_2048_to_1024 0.82 ± 0.089 ms 0.889 ± 0.093 ms 0.923 ± 0.14
rechunk_state/types/Float64_2048_to_1024 1.62 ± 0.11 ms 1.72 ± 0.15 ms 0.942 ± 0.1
rechunk_state/types/Int16_2048_to_1024 0.42 ± 0.047 ms 0.534 ± 0.06 ms 0.786 ± 0.12
rechunk_state/upsample/1024_to_10000_1ch 0.841 ± 0.055 ms 0.799 ± 0.058 ms 1.05 ± 0.1
rechunk_state/upsample/512_to_2048_1ch 0.402 ± 0.04 ms 0.397 ± 0.041 ms 1.01 ± 0.15
rechunk_state/upsample/512_to_2048_4ch 1.85 ± 0.088 ms 1.7 ± 0.094 ms 1.09 ± 0.08
rechunk_state/zero_copy/near_passthrough_2048_1ch 1.66 ± 0.091 ms 1.69 ± 0.1 ms 0.985 ± 0.081
rechunk_state/zero_copy/near_passthrough_2048_4ch 9.12 ± 15 ms 7.35 ± 0.33 ms 1.24 ± 2.1
rechunk_state/zero_copy/near_passthrough_8192_4ch 0.0519 ± 0.076 s 29.7 ± 53 ms 1.75 ± 4
rechunk_state/zero_copy/passthrough_2048_1ch 4.17 ± 0.42 μs 4.44 ± 0.48 μs 0.939 ± 0.14
rechunk_state/zero_copy/passthrough_2048_4ch 5.02 ± 0.5 μs 4.86 ± 0.24 μs 1.03 ± 0.12
rechunk_state/zero_copy/passthrough_8192_4ch 5.36 ± 1.3 μs 5.6 ± 1.2 μs 0.957 ± 0.31
tee/buffer=1 0.624 ± 0.019 ms 0.626 ± 0.017 ms 0.997 ± 0.041
tee/buffer=16 0.0956 ± 0.008 ms 0.0958 ± 0.0019 ms 0.998 ± 0.086
tee/buffer=4 0.199 ± 0.016 ms 0.201 ± 0.007 ms 0.99 ± 0.088
tee/buffer=64 0.0691 ± 0.0095 ms 0.0693 ± 0.015 ms 0.997 ± 0.26
time_to_load 1.65 ± 0.018 s 1.62 ± 0.044 s 1.02 ± 0.03
Memory benchmarks
main 7513db7... main / 7513db7...
channel/buffer=1 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=1024 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=16 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=256 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=4 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=64 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
rechunk/10000_to_2048/buffer=1 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/10000_to_2048/buffer=16 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/10000_to_2048/buffer=4 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/10000_to_2048/buffer=64 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/2048_to_10000/buffer=1 13 allocs: 0.781 kB 13 allocs: 0.781 kB 1
rechunk/2048_to_10000/buffer=16 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/2048_to_10000/buffer=4 13 allocs: 0.781 kB 12 allocs: 0.75 kB 1.04
rechunk/2048_to_10000/buffer=64 13 allocs: 0.781 kB 12 allocs: 0.75 kB 1.04
rechunk_state/batch/batch_2048_to_512_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/batch_2048_to_512_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/batch_512_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/batch_passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_2048_to_512_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_2048_to_512_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_512_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/channels/2048_to_1024_1ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/channels/2048_to_1024_2ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/channels/2048_to_1024_4ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/channels/2048_to_1024_8ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/downsample/10000_to_1024_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/downsample/2048_to_512_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/downsample/2048_to_512_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/passthrough/2048_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/passthrough/2048_to_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/ComplexF64_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/Float32_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/Float64_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/Int16_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/upsample/1024_to_10000_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/upsample/512_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/upsample/512_to_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/near_passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/near_passthrough_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/near_passthrough_8192_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/passthrough_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/passthrough_8192_4ch 0 allocs: 0 B 0 allocs: 0 B
tee/buffer=1 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
tee/buffer=16 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
tee/buffer=4 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
tee/buffer=64 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
time_to_load 0.145 k allocs: 11 kB 0.145 k allocs: 11 kB 1

@zsoerenm
zsoerenm merged commit 38a9f0a into main Jan 23, 2026
7 checks passed
@zsoerenm
zsoerenm deleted the ss/tee-val-n branch January 23, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant