Skip to content

refactor(noq): change the way a disabled token store or token log is represented internally#697

Open
rklaehn wants to merge 3 commits into
mainfrom
rklaehn/refactor-token-log-2
Open

refactor(noq): change the way a disabled token store or token log is represented internally#697
rklaehn wants to merge 3 commits into
mainfrom
rklaehn/refactor-token-log-2

Conversation

@rklaehn

@rklaehn rklaehn commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Change the way a disabled token store or token log is represented internally from Arc<dyn Token...> with a Noop impl to Option<Arc<dyn Token...>> that is None.

This allows the code that uses the store/log to recognise if the mechanism is disabled and to exit early. It also avoids a dyn call to a noop fn, but that is a tiny benefit.

Breaking Changes

None

Notes & open questions

Note: the way this is implemented is via deprecating, not removing, the NoopToken... impls, and adding a builder fn to disable the store/log. A more idiomatic impl would remove the Noop impls and change the builder setter to take an Option.

Note: Given that neither the token store nor the token log provide much benefit for iroh connections, I would like to disable both in iroh. But since they do provide a lot of benefit for traditional QUIC connections, they would have to be enabled by default in noq, as is the case now. So we need a way to clear them.

But the latter would require a breaking change.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

rklaehn added 2 commits June 9, 2026 11:53
if the mechanism (client side or server side token store/log) is disabled.

We don't remove the Noop impls yet since that would break the public API.
…ide token log

This is unidiomatic for the library. In other places we have setters on builders
that take an option. But it's the only thing we can do that does not break the
public API.

E.g. pub fn mtu_discovery_config(&mut self, value: Option<MtuDiscoveryConfig>) -> &mut Self {
@rklaehn rklaehn marked this pull request as draft June 9, 2026 09:37
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Performance Comparison Report

c76925f826bf87520814f7b159ee1314afbcc16a - artifacts

No results available

---
f4bf3adf77f557c596f96e6970d54659ab8ce939 - artifacts

Raw Benchmarks (localhost)

Scenario noq upstream Delta CPU (avg/max)
large-single 5291.3 Mbps 8021.6 Mbps -34.0% 95.2% / 100.0%
medium-concurrent 5443.9 Mbps 7315.0 Mbps -25.6% 95.7% / 151.0%
medium-single 4045.1 Mbps 4749.2 Mbps -14.8% 98.5% / 152.0%
small-concurrent 3809.2 Mbps 5204.7 Mbps -26.8% 93.5% / 103.0%
small-single 3536.3 Mbps 4763.7 Mbps -25.8% 94.3% / 103.0%

Netsim Benchmarks (network simulation)

Condition noq upstream Delta
ideal 3086.7 Mbps 3995.0 Mbps -22.7%
lan 782.4 Mbps 810.3 Mbps -3.4%
lossy 69.8 Mbps 69.8 Mbps ~0%
wan 83.8 Mbps 83.8 Mbps ~0%

Summary

noq is 25.3% slower on average

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/noq/pr/697/docs/noq/

Last updated: 2026-06-09T09:43:04Z

@n0bot n0bot Bot added this to iroh Jun 9, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Jun 9, 2026
@rklaehn rklaehn marked this pull request as ready for review June 9, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚑 Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant