Commit Graph
20 Commits
Author SHA1 Message Date
Daniel Eggert 13a8d51c9e Encode message identifier sets with an index loop
writeArray iterates RangeSet.Ranges with its iterator, which costs two
mallocs per range inside libswiftCore; subscripting by index costs none.
Output unchanged.

mallocs, measured at the stack tip with the IMAPEncoding benchmarks
(added in PR 4): encode.command.select_qresync 20 → 6,
uid_fetch_set_fragmented 20 → 6, uid_store_add_seen 8 → 6,
encode.commands.all 356 → 284.

The writeArray call is upstream code; the cost is also on main.
2026-11-20 12:49:14 +01:00
Daniel Eggert 9491d31e2a Additional Tests (#811) 2026-03-09 09:58:21 -04:00
Daniel Eggert af9dbf1d92 Cleanup and improve tests (#809) 2026-03-03 13:01:01 -05:00
Franz Busch 2cd1c5582a [CI] Adopt GitHub Actions (#775)
* [CI] Adopt GitHub Actions

# Motivation

We want to adopt GitHub actions in all of our Swift repositories to replace our current Jenkins CI.

# Modification

This PR adopts the reusable workflows from NIO and the swiftlang organization to ensure soundness and test coverage. Additionally, this PR enables a sematic label check and adds a `release.yml` to make releasing this package easy.

# Result

Modern CI and release flow.
2024-10-30 13:24:35 +00:00
Daniel Eggert 18dd5d5193 Call through to RangeSet for SetAlgebra where possible (#732) 2023-02-22 12:17:48 +01:00
Daniel Eggert bb0e803d99 UID convenience (#682) 2022-02-04 15:21:13 +01:00
Daniel Eggert 17b0f8e467 Add isContiguous to MessageIdentifierSet (#650)
With the recent changes to message identifier set it’s no longer possible to access the range count, but we’d only ever need that to calculate isContiguous. Moving this into NIOIMAPCore seems like the better approach.
2021-12-13 10:33:35 +00:00
David Evans 0490280833 Remove SequenceRange and SequenceRangeSet (#640)
Note - I'll update documentation in a follow-up PR

Remove SequenceRange and SequenceRangeSet and replace with new MessageIdentifier* types.

Motivation:

There was lots of very complicated duplicate code, and there was about to be more if we didn't make the new MessageIdentifier types.

Modifications:

Replace basically every occurrence of SequenceRange with MessageIdentifierRange<SequenceNumber> and SequenceRangeSet with MessageIdentifierSet<SequenceRangeNumber>.
Result:

Lots of lines deleted.
2021-11-30 10:52:46 +00:00
David Evans d936fce407 Replace UIDSet* with generic MessageIdentificationSet (#638)
In a previous PR we made UID conform to a new protocol MessageIdentifier. This PR continues the trend of removing concrete types and replacing them with generic types.

In this case we have UIDSet and UIDSetNonEmpty. These are identical to SequenceNumberSet and SequenceNumberSetNonEmpty. To allow us to remove the duplicate code a new generic type MessageIdentifierSet has been defined that takes a generic parameter T: MessageIdentifier. Both UID and SequenceNumber conform to MessageIdentifier.

In the next PR I will remove the code for SequenceNumberSet* and replace with MessageIdentifierSet. This PR only addresses the UIDSet* types.

Note: I will update all documentation in another (probably the last) PR.
2021-11-24 09:53:56 +00:00
David Evans 4036cd48cd Define generic message identification protocol (#637)
A "message identifier" can be a UID, a SequenceNumber, or an unknown instance of the two (because they look the same it's impossible to distinguish when parsing).

Originally we had the 3 types duplicated 3 times, however this PR brings us closer to have one implementation. While code duplication isn't usually "that bad", in this case it can be an issue as :

The code is complicated
There's a lot of it
This PR works to address a few things, using the UID type as a proof-of-concept:

Make UID conform to a protocol MessageIdentifier
Create a new MessageIdentifierRange type that will eventually replace the UIDRange and SequenceNumberRange types.
2021-11-23 11:44:05 +00:00
David Evans a66eeb228b Use SPI to remove underscored members (#567)
Resolves #556

We've talked quite a bit offline, and decided that for now @_spi is the way to go, as it avoids build system issues. The goal is to remove the number of underscored public types and fields.
2021-06-02 19:21:47 +01:00
David Evans 94e3fb42f5 Update dependencies (#493)
* Update packages

* Run swift format

* Update
2021-03-23 17:21:41 +00:00
David Evans 1e0f89fd11 Non empty UID set (#448)
* Convert UIDSet to LastCommandSet

* Soundness

* Define UIDSetNonEmpty

* Use UIDSetNonEmpty

* Soundness

* Fix tests

* Soundness

* Convenience funcs

* Soundness

* Fix compile

* Use parseOneOf

* Soundness
2021-03-05 17:48:42 +00:00
Daniel Eggert 594e1caedc Add RangeView to UIDSet (#447)
* Add RangeView to UIDSet

* Fix for Swift 5.2
2021-02-16 16:17:34 +00:00
Daniel Eggert e704d7f4d9 Make UIDSet conform to RandomAccessCollection (#445) 2021-02-15 15:59:58 +00:00
Daniel Eggert 2f409effef Conform to CustomDebugStringConvertible (#408)
…instead of CustomStringConvertible
2021-01-21 13:34:19 +00:00
Daniel Eggert 44b7991dc4 Make UIDSet conform to Collection and SetAlgebra (#393) 2020-12-15 16:10:51 +00:00
Matt Diephouse 99b41de069 Make UID, UIDRange, and UIDSet CustomStringConvertible (#360)
* Make UID CustomStringConvertible

* Make UIDRange CustomStringConvertible

* Make UIDSet CustomStringConvertible
2020-11-11 18:41:00 +00:00
Matt Diephouse a704b73e6e Fix parsing and encoding of UID.max (#359)
* Fix parsing and encoding of UID.max

* Adjust formatting
2020-11-11 16:49:35 +00:00
Daniel Eggert 30cdf896ff Create type for UID / UIDSet and use UIDs vs. Sequence Numbers (#166)
* Create type for UID / UIDSet and use UIDs vs. Sequence Numbers as appropriate.

* Remove commented out code.

* Linting.
2020-05-26 11:08:08 +01:00