Motivation:
Standardised formatting makes the project cleaner to look at and work
on.
Modifications:
Setup swift-format with the same settings as Swift-NIO
Result:
Common formatting throughout
Motivation:
`Bench1Conn10kRequests` performance tester incorrectly used a `NIOLoopBound` to access the `HTTP2StreamMultiplexer` to create streams.
Modifications:
Access the multiplexer by safely obtaining a reference to the handler.
Result:
- `Bench1Conn10kRequests` are not broken
Motivation:
To address warnings revealed with
`.enableExperimentalFeature("StrictConcurrency=complete"),` in Swift 5.8
Modifications:
* Numerous protections of state in tests
* Make the multiplexer instances explicitly loop bound
* Update channel initializers to be marked as Sendable
* Mark error backing storage types as unchecked sendable
Result:
Better thread safety
Motivation:
When adding in the SPI methods for exposing async sequences of HTTP/2
streams we moved the stream initialization to a subtly different
location so that it was easier to exfiltrate the outputs of those
initialization functions (such as protocol negotiation outputs).
In some cases this broke ordering expectations.
Modifications:
Yield the (optionally wrapped) channels as initializer outputs to the async stream
Result:
Changes only exist within SPI. Async inbound stream channel
initialization now matches previous behavior.
Motivation:
#fileID introduced in Swift 5.3, so no longer need to use #file anywhere
Modifications:
Changed #file to #filePath or #fileID depending on situation
Motivation:
`HPACKHeaders` has an `init` which will normalize `HTTPHeaders`, this
includes removing any headers which are illegal in HTTP2 and any headers
which present as a 'connection' header value. As written this is
expensive in some edges cases. With perf tests we can validate that
implementation changes improve performance.
Modifications:
Add a performance test to normalize `HTTPHeaders`. This is run on two
configurations.
Result:
More insight into header normalisation perf.
Motivation:
To justify performance changes we need to measure the code being
changed. We believe that `HPACKHeaders.subscript(canonicalForm:)` is a
little slow.
Modifications:
- Add allocation and performance tests for fetching header values in
their canonical form
Results:
More benchmarks.
Motivation:
With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.
Modifications:
- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded imports where necessary in tests.
- Note that the main modules still depend on NIO, which is necessary
for backwards-compatibility reasons. This dependency is unused.
Result:
No need to use NIOPosix.
Motivation:
NIO 2.26.0 saved us some allocations, some of our limits are now too
high and CI fails as a result.
Modifications:
- Adjust the allocation counter limits.
- Replace a 'class' constraint with 'AnyObject'
Result:
CI passes.
The run-all mode of the performance tester inadvertently got removed in
a previous patch. This adds it back.
Along the way we have apparently unlocked some perf gains in a new NIO
release.
Motivation:
The init() of all benchmarks will execute, even when we filter a
benchmark run down to a single benchmark. We should avoid doing heavy
work there, because it can confuse us when we look at traces elsewhere.
Modifications:
- Move some heavy work in the huffman benchmark base64 decode out of
init().
- Prevent setUp() and tearDown() from running if a test is filtered out.
- Avoid even creating benchmarks unless they're filtered in.
Result:
Less confusing benchmark traces.
Motivation:
We don't have any benchmarks or alloc counter tests for doing stream
teardown with GOAWAY frames. While this isn't a terribly hot code path
and isn't terribly performance heavy with allocations, it's good to have
more data here.
Modifications:
- Write benchmarks and alloc counter tests that tear down many streams
with GOAWAY.
Result:
Better testing and alloc counter.
Motivation:
Performance benchmarking wants accurate numbers, and a wide range of
possible benchmarks. One way to get somewhat more accurate numbers is to
use a tool like Cachegrind to measure the instruction counts of a
program. Cachegrind allows us to isolate a number of noise-introducing
effects, as "number of executed instructions" is a much more stable
number than how long a program takes to run.
When running under cachegrind we want to change the way our performance
benchmarks work. Instead of running lots of times to try to average out
noise, we only want to run once to save ourselves time, as the benchmark
itself should be drastically more stable.
While we're here, let's add some much more isolated benchmarks than our
current "make lots of streams" benchmark. This is basically the same
logic, but it does less of NIO and so makes the impact of NIOHTTP2
substantially more prominent.
Modifications:
- Added a cachegrind build mode to the benchmarks.
- Added new benchmarks and alloc counters.
Result:
More info
Motivation:
As part of #214 we need to introduce new pipeline helpers to configure
the channel pipeline with the new handlers. This PR adds those helpers
and deprecates the old paths.
Modifications:
- Add pipeline helpers with the new streamID-less initializer
- Switch old pipeline helpers which provided codecs to use the new path
and codecs
- Duplicate SimpleClientServerTests and ConfiguringPipelineTests to add
frame payload based counterparts
- Deprecate older helpers and multiplexer init, delete tests which don't
hit deprecated paths (note: these still exist in the payload based
counterparts)
- Update Bench1Conn10kRequests to be payload based
Result:
- More 'FramePayload' based Tests
- Paths for creating an 'HTTP2Frame' based stream via
'HTTP2StreamMultiplexer' are now deprecated
Motivation:
Having benchmarks for the HPACK encoder and decoder gives us better
insight into their performance. While we have some simple benchmarks in
the XCTests, using the NIO performance tester framework will give us
more insight into what's happening.
While we're here, we can move the Huffman benchmarks out of the unit
tests and into the benchmark suite.
Modifications:
Added encoder, decoder, and huffman benchmarks.
Result:
Better performance numbers.