Skip to content

swift-cidr 0.10.0

Choose a tag to compare

@camunro camunro released this 13 Nov 16:00
· 3 commits to main since this release
Immutable release. Only release title and notes can be modified.
0.10.0
e268b13

Changes since 0.9.0.

Append summarization

Three additive public APIs let callers summarize into an existing array:

  • IPPrefix.summarize(from:to:into:)
  • IPAddressRange.summarizedNetworks(into:)
  • IPAddressCoverage.summarizedNetworks(into:)

Existing array-returning methods delegate to these overloads. Both forms expose
their implementation to downstream specialization with @inlinable.

Each invocation appends an ordered, minimal set of canonical prefixes for its
own exact address coverage. Earlier destination elements remain unchanged;
there is no merging, deduplication, or reordering across invocations. Reversed
ordered endpoints and empty coverage append nothing. Prefix context on address
endpoints does not change the interval being summarized.

Coverage summaries append directly into one destination, eliminating the
per-range temporary arrays. Reserving one output element per range is a lower
bound: destination growth and copy-on-write may still allocate. Retaining
capacity between calls can reuse destination storage.

The summarization loop handles the full address space separately, then exits
when its emitted block exactly consumes the remaining interval. Wrapping
arithmetic is used only where the ordered-range and block-size invariants prove
the mathematical results are representable. Storage width remains authoritative
for custom address families, even when their declared width metadata differs.

Other changes since 0.9.0

The already-merged constant-access optimization removes lazy initialization
from mapped IPv6 formatting and IPv6 multicast constants. Its evidence remains
separate from the summarization measurements.

Compatibility and verification

The Swift 6.2 minimum, macOS 15 / iOS 18 deployment floors, existing public
method signatures, and four library products are unchanged. This release adds
overloads without changing exact coverage, output ordering, or canonical prefix
semantics.

All 295 tests passed in each of twelve full configurations: the original ten
macOS/native Linux runs with Swift 6.2.4 and 6.3.3, plus fresh macOS Debug and
Release runs with Xcode 27.2 / Swift 6.4.2. All four products also passed iOS 18
simulator deployment compile checks with SDK 27.2; these are not runtime tests.

Fresh matched Xcode 27.2 counter-disabled controls for 16,384 fragmented ranges
measured IPv4 coverage at 114.5 ms → 1.48 ms and IPv6 at 432.4 ms → 11.63 ms.
All 44 returning workloads improved in six paired full-profile rounds. Reused
buffers reported zero in every exported malloc observation across three runs;
this requires the measured uniquely owned, preallocated storage conditions.
These figures describe the combined patch, including downstream specialization,
on those fixtures and environment. Allocator interposers remained loaded.

The summarization and standard benchmark registration closures now explicitly
use @Sendable to match the runner's nonisolated hook under Swift 6.4.2. Both
new benchmark variants received the identical adjustment; timed callback bodies
and production code were unchanged by it. Both targets also compile with 6.3.3.

The 79-case macOS CIDRBenchmarkTarget matched regression check and six targeted
follow-up checks passed, with unchanged count metrics. Historical absolute
limits failed for 15 baseline and 16 candidate cases, including 15 shared cases;
the thresholds were preserved during the experiment. Five initial formatter p90 increases did not
repeat at the same magnitude: paired follow-up medians ranged from -1.33% to
+1.12%. The standard check does not cover CPU/NIO targets or establish a full
cross-platform regression result. Historical thresholds span different host
and toolchain environments and alone do not establish a patch regression.

Earlier Xcode 26.6 and native Linux results remain preserved with their original
toolchain labels. The new macOS results are recorded separately.

See the measurement report
for allocation observations, methodology, sample limits and validation scope.

A separate maintenance commit refreshes all 79 historical absolute threshold
JSON files from the preserved Swift 6.4.2 candidate run. All allocation/ARC
values and existing tolerance settings remain unchanged. One fresh full-suite
verification passed these limits without further adjustment. The earlier
experiment results remain intact; see the threshold maintenance record.