Commit Graph
15 Commits
Author SHA1 Message Date
Daniel Eggert b193b1c18a Add before/after script for IMAPDispatchClient
compare-dispatch-client.sh benchmarks a pinned pre-migration worktree
against this tree. README records the results; Package.swift and
IMAPDispatchClient.swift point to it.
2026-11-24 09:48:37 +09:00
Daniel Eggert 5caa77d7be Add IMAPProfile and a baseline-comparison summarizer
IMAPProfile runs one corpus N times, for tracing under Instruments'
Allocations template; the README says how to read the trace.
summarize-comparison.py condenses `baseline compare` output.
2026-11-24 09:48:37 +09:00
Daniel Eggert 3e59038ff5 Add IMAPParsing and IMAPEncoding thresholds (generated)
Output of `benchmark thresholds update`, measured before a rebase and
not re-measured since. Host-specific; not gated in CI. Apple M5 Max,
macOS 27.3, Swift 6.4.4. From Examples/PerformanceTester, with
six = --metric mallocCountTotal --metric mallocBytesCount
      --metric objectAllocCount --metric retainCount
      --metric releaseCount --metric retainReleaseDelta
two = --metric mallocCountTotal --metric mallocBytesCount:
  swift package --disable-sandbox benchmark thresholds update \
    --target IMAPParsing $six
  swift package --disable-sandbox benchmark thresholds update \
    --target IMAPEncoding --skip 'encode\.dispatch\..*' $six
  swift package --disable-sandbox benchmark thresholds update \
    --target IMAPEncoding --filter 'encode\.dispatch\..*' $two
2026-11-24 09:48:37 +09:00
Daniel Eggert f1a5b029ab Add IMAPEncoding benchmarks
Encoder benchmarks for commands and responses, through contiguous,
NIO-handler and DispatchData drivers. Adds those drivers to
IMAPBenchmarkSupport, plus the response model corpus.

IMAPDispatchClient's no-ARC note now points at encode.dispatch.*'s.
2026-11-24 09:48:37 +09:00
Daniel Eggert 9adb7fbf04 Add IMAPParsing benchmarks
Parser benchmarks for commands and responses, plus IMAPBenchmarkSupport:
the command corpus and the parse drivers. Post-migration only; not
built with IMAP_IMPL=main.
2026-11-24 09:48:35 +09:00
Daniel Eggert e7732411fe Make IMAPBuffer.dispatchDonationThreshold internal
A tuning value nothing outside Core needs. Docs outside it now give
the number instead of the name.
2026-11-24 09:48:20 +09:00
Daniel Eggert ba7308e77b Update IMAPDispatchClient thresholds (generated)
Generated with the two commands in "Add IMAPDispatchClient benchmark
thresholds (generated)", before a rebase; not re-measured since.
"Regenerate benchmark thresholds (generated)" re-measures later.
Apple M5 Max, macOS 27.3, Swift 6.4.4.
2026-11-24 09:48:18 +09:00
Daniel Eggert 854a5256f0 Measure IMAPDispatchClient against either library
The DispatchData client now has two drivers. DispatchClient+Current
uses IMAPInputBuffer (each read appended with append(contentsOf:)),
IMAPBuffer payloads and IMAPOutputBuffer donated via
makeDispatchData(); DispatchClient+Legacy, the ByteBuffer client,
compiles only under IMAP_LEGACY_BUFFERS. IMAP_IMPL=main in Package.swift
points the path dependency at a pre-migration checkout (IMAP_MAIN_PATH)
and defines that flag, so one set of case names yields before/after
numbers.

The encode cases' no-ARC note gains the reasons donation adds: the
queue-dependent retain deltas and the thread the hook race fires on.

Built both ways (IMAP_IMPL=main against f5fa7d36). Thresholds follow
separately.
2026-11-24 09:48:18 +09:00
Daniel Eggert e83d3dcb8a Require OS 26 platforms; enable Lifetimes
The new byte types need `Span`-producing stdlib accessors (`Array.span`,
`String.utf8Span`) that are gated at 26. Also adds `DequeModule`.

Public break: raises the deployment floor to 26 on every platform (was
macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2). Examples follow,
since a path dependency cannot have a higher floor than its dependent.
2026-11-24 09:47:31 +09:00
Daniel Eggert ec07823d59 Add IMAPDispatchClient benchmark thresholds (generated)
From Examples/PerformanceTester:
  swift package --disable-sandbox benchmark thresholds update \
    --target IMAPDispatchClient --filter 'dispatch-client\.parse\..*' \
    --metric mallocCountTotal --metric mallocBytesCount \
    --metric objectAllocCount --metric retainCount \
    --metric releaseCount --metric retainReleaseDelta
  swift package --disable-sandbox benchmark thresholds update \
    --target IMAPDispatchClient --filter 'dispatch-client\.encode\..*' \
    --metric mallocCountTotal --metric mallocBytesCount
Apple M5 Max, macOS 27.3, Swift 6.4.4.
2026-11-24 09:47:25 +09:00
Daniel Eggert b7783878e8 Replace PerformanceTester with ordo-one/benchmark suite
IMAPDispatchClient: a DispatchData client (parse + encode), measured
with allocation counters (plus ARC counters for parsing) instead of
Date(). Needs Swift 6.3 (malloc-interposer), so CI builds it in its own
job.

The "Legacy" file name anticipates the migration's
DispatchClient+Current.
2026-11-24 09:47:23 +09:00
Daniel Eggert 4606da62d2 Validate response text, command tags and namespace delimiters (#866)
* Reject invalid response text when writing

`.no(.init(text: "No mailbox x\r\n* BYE pwned"))` was written verbatim,
injecting an untagged response; likewise tagged, BYE, PREAUTH and
continuation responses.

RFC 9051: `text = 1*(TEXT-CHAR / UTF8-2 / UTF8-3 / UTF8-4)`. `writeText`
now asserts no NUL, CR or LF. Empty stays valid. The parser now accepts
UTF-8 text.

* Add Command.Tag for command and response tags

`TaggedCommand(tag: "A1 NOOP\r\nA2 DELETE INBOX\r\nA3", command: .noop)`
was written verbatim, injecting a command; likewise `APPEND` start.
`TaggedResponse(tag: "* BYE x\r\nA1", …)` injected a response.

RFC 3501: `tag = 1*<any ASTRING-CHAR except "+">`. New `Command.Tag`
replaces the `String` in `TaggedCommand`, `TaggedResponse`, `Response`,
`CommandStreamPart`, `AppendCommand`, `BadCommand` and NIOIMAP's state
machine errors; `init?(_:)` validates, literals trap. The parser already
enforces the production. IMAPCommands converts its numeric tags.

* Validate and escape namespace delimiters

`NamespaceDescription(string: "x", char: "\r\n", …)` wrote a raw CRLF
inside `"…"`, injecting a response. `"\""` encoded as `"""`, and `"\\"`
as `"\"` (unterminated); non-ASCII was accepted.

RFC 2342: `DQUOTE QUOTED-CHAR DQUOTE / nil`. `init(string:delimiter:
responseExtensions:)` (was `char:`) throws `InvalidDelimiterError` for
non-ASCII, CR, LF, NUL; the delimiter is stored as a byte, read-only.
Quoted-specials are escaped on write and parsed when escaped.

* Gate a capturing exit test on Swift 6.3
2026-11-04 17:41:52 +00:00
Daniel Eggert e536be599e Reject invalid AuthenticationMechanism (#846) 2026-09-01 10:11:11 +02:00
Daniel Eggert c4d4d23e29 Drop pre-Swift 6.2 (#845) 2026-08-29 09:23:34 +02:00
Daniel Eggert 1057994e93 Move examples into sub-dir (#834) 2026-07-18 12:00:06 +02:00