Skip to content

Benchmarks for channel pipeline creation#3531

Merged
glbrntt merged 3 commits intoapple:mainfrom
Lukasa:cb-benchmarks-for-channelpipeline
Mar 16, 2026
Merged

Benchmarks for channel pipeline creation#3531
glbrntt merged 3 commits intoapple:mainfrom
Lukasa:cb-benchmarks-for-channelpipeline

Conversation

@Lukasa
Copy link
Copy Markdown
Contributor

@Lukasa Lukasa commented Mar 2, 2026

Motivation:

Creating channel pipelines is a fairly expensive operation. We should try to know how expensive.

Modifications:

Add benchmarks for ChannelPipeline setup.

Result:

We'll know more.

Some results in a Linux VM on my M4 Max laptop:

=================
NIOCoreBenchmarks
=================

ChannelPipeline.init(0 handlers)
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Malloc (total) *         │         3 │         3 │         3 │         3 │         3 │         3 │         3 │      1000 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (ns) * │       156 │       177 │       214 │       322 │       367 │       989 │      2148 │      1000 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

ChannelPipeline.init(1 handler)
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Malloc (total) *         │         5 │         5 │         5 │         5 │         5 │         5 │         5 │      1000 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (ns) * │       269 │       290 │       301 │       463 │       501 │       583 │       611 │      1000 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

ChannelPipeline.init(3 handlers)
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Malloc (total) *         │         9 │         9 │         9 │         9 │         9 │         9 │         9 │      1000 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (ns) * │       477 │       521 │       540 │       553 │       574 │       817 │       907 │      1000 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

ChannelPipeline.init(10 handlers)
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Malloc (total) *         │        23 │        23 │        23 │        23 │        23 │        23 │        23 │      1000 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (ns) * │      1263 │      1363 │      1404 │      1679 │      2146 │      2482 │      3133 │      1000 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

Motivation:

Creating channel pipelines is a fairly expensive operation. We should
try to know how expensive.

Modifications:

Add benchmarks for ChannelPipeline setup.

Result:

We'll know more.
@Lukasa Lukasa added the semver/none No version bump required. label Mar 2, 2026
@glbrntt glbrntt merged commit b9d20d3 into apple:main Mar 16, 2026
51 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants