refactor(noq): change the way a disabled token store or token log is represented internally#697
Open
rklaehn wants to merge 3 commits into
Open
refactor(noq): change the way a disabled token store or token log is represented internally#697rklaehn wants to merge 3 commits into
rklaehn wants to merge 3 commits into
Conversation
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 {
Performance Comparison Report
|
| 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
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Change the way a disabled token store or token log is represented internally from
Arc<dyn Token...>with aNoopimpl toOption<Arc<dyn Token...>>that isNone.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