Commit Graph
17 Commits
Author SHA1 Message Date
George Barnett 9a582726cf Strict concurrency for perf tests and the h2 server (#509) 2025-03-31 11:31:38 +01:00
Peter Adams 1118370ec4 Apply swift-format changes and CI (#472)
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
2024-10-29 13:09:54 +00:00
Rick Newton-Rogers d47899f82f fix Bench1Conn10kRequests crash (#434)
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
2024-01-08 08:25:38 -08:00
Rick Newton-Rogers 285e444b49 Sendability warnings (#417)
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
2023-11-01 14:36:38 +00:00
Rick Newton-Rogers 8275314739 Async stream initializers order matches existing (#415)
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.
2023-09-11 14:46:40 +01:00
carolinacass d6656967f3 Use #fileID/#filePath instead of #file (#359)
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
2022-11-01 08:27:30 -07:00
George Barnett ed25fecd40 HPACKHeaders performance test for HTTPHeader normalisation (#346)
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.
2022-05-17 09:31:47 +01:00
George Barnett 80f02ef18a Add perf and alloc tests for getting headers (#303)
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.
2021-09-27 12:43:35 +01:00
Cory Benfield dbfc8fcd1a Clean up imports and dependencies. (#300)
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.
2021-09-14 11:30:04 +01:00
George Barnett 26ddb6e007 Update allocation count requirements (#281)
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.
2021-03-09 13:50:57 +00:00
Cory Benfield 59941f6803 Re-add "run all" mode to performance tester (#272)
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.
2021-01-11 17:12:55 +00:00
Cory Benfield ec1fad4c07 Move the huffman benchmark base64 out of init (#262)
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.
2020-11-26 08:43:13 +00:00
Cory Benfield 3315a639de Add benchmark and alloc test for GOAWAY teardown. (#260)
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.
2020-11-24 17:24:42 +00:00
Cory Benfield 54f15a6b16 Add benchmarks and improve benchmarking. (#256)
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
2020-11-19 11:09:09 +00:00
George Barnett 177c50a566 Add new pipeline helpers and deprecate old paths (#226)
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
2020-08-04 12:52:00 +01:00
Cory Benfield 7cc32a9a41 Add HPACK & Huffman benchmarks. (#167)
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.
2019-11-13 08:43:10 +00:00
Johannes Weiss 522464d81e HTTP/2 peformance tests (#117)
Motivation:

NIO wants to be fast, we should have perf tests everywhere.

Modifications:

Start with one HTTP/2 perf test.

Result:

more perf tests.
2019-05-16 18:21:17 +01:00