Commit Graph
45 Commits
Author SHA1 Message Date
inju2403 a3baec1887 [Benchmark] Add OrderedSet<Int> reverse benchmark 2026-06-12 09:41:47 +09:00
Karoy Lorentey 5c8d97dccb Merge pull request #660 from apple/dn/ordered-set-move
[OrderedCollections] Add move operations
2026-06-05 17:45:16 -07:00
David Nadoba 5a6af29d55 [OrderedCollections] Refine move APIs and simplify no-op check 2026-06-05 14:44:22 -07:00
David Nadoba a83773321e [OrderedCollections] Rework move APIs and extend to OrderedDictionary
Reworks the relocation API and extends it to `OrderedDictionary`:

* Renames the index-range move to `moveSubrange(_:to:)` (with a
  `RangeExpression` overload) and the by-value move to `move(contentsOf:to:)`,
  matching the conventions of `removeSubrange`/`insert(_:at:)`. Adds
  `move(fromIndices:to:)`, which takes the source indices directly.
* Factors the element rearrangement into generic
  `UnsafeMutableBufferPointer` operations (rotation / rotation+permutation /
  scatter) so `OrderedDictionary` relocates its keys and values in lockstep
  through the same code, adding only the parallel value move; the hash-table
  maintenance stays entirely in `OrderedSet`.
* The hot path runs in O(*d* + *k*) and falls back to O(`count`) for large
  moves; bucket maintenance chooses targeted updates or a full rebuild by the
  same threshold.
* `move(contentsOf:to:)` ignores elements/keys that aren't present; duplicate
  members are detected and trap.

Adds tests (exhaustive hash-table integrity, value alignment under lifetime
tracking) and move benchmarks for both types.
2026-06-04 22:33:54 -07:00
Karoy Lorentey c86ed20fc1 [Benchmark] Shareable(Set|Dictionary)Benchmarks → Tree$1Benchmarks 2026-06-02 17:57:49 -07:00
Karoy Lorentey b78086e6df [Benchmark] Resolve warnings under Swift 6.4 2026-06-02 17:48:22 -07:00
Karoy Lorentey 7a32c7582b [Benchmark] Enable sorted collection benchmarks, conditional on UnstableSortedCollections 2026-06-02 17:48:04 -07:00
Karoy Lorentey 76f3560f3f [Benchmark] ENABLE_RUST_BENCHMARKS → EnableRustBenchmarks 2026-06-02 17:43:37 -07:00
David Nadoba 508f36f48d [OrderedSet] Add move(_:toOffset:)
Adds two overloads for relocating elements within an `OrderedSet`: one
taking a contiguous `Range<Int>`, and one taking a `Sequence<Element>`.
The moved elements occupy consecutive positions starting at the
destination, in the order they appear in the input.

The hot path runs in O(*d* + *k*) time, where *d* is the distance moved
and *k* is the number of elements moved; the implementation falls back
to O(`count`) for large moves.
2026-05-25 23:01:28 -07:00
Karoy Lorentey 32e7c0e1ec [Benchmark] Add BitSet iteration vs index(after:) benchmarks 2026-04-21 16:28:11 -07:00
Karoy Lorentey 11443c0531 Enforce uniform license headers 2026-03-07 10:26:28 -08:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey 11a49663d0 [Benchmarks] Update benchmarking sub-package
- Fix issues with the main package no longer exposing internal helper functions
- Move Rust benchmarks behind an EnableRustBenchmarks trait
- Allow traits to be enabled in `Utils/run-benchmarks.sh` through the BENCHMARK_TRAITS environment variable.
2026-03-05 19:39:22 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Alejandro Alonso 3975774393 wip 2025-10-23 15:05:12 -07:00
Karoy Lorentey 05ad8633a8 Merge branch 'release/1.2' 2025-06-24 15:06:25 -07:00
Karoy Lorentey f1b0eba948 [BigString] Add some basic benchmarks 2025-06-23 15:21:36 -07:00
Karoy Lorentey ecf44620d2 Also disable SortedCollections benchmarks 2025-05-20 15:23:02 -07:00
Karoy Lorentey 5dd817c33d Merge branch 'release/1.1' 2024-08-05 20:10:26 -07:00
Karoy Lorentey 5e1fe6e8f0 [BigString] Fix accidentally quadratic BigString.init
When ingesting a `String` instance, `BigString` assumes that the input string has a reasonably efficient UTF-8 view.

Unfortunately, that is very much not the case when the input happens to be backed by a bridged NSString object — it appears that in this case, the ingester loop invokes some operation(s) with linear complexity in the size of the entire input, rendering the ingester’s overall complexity quadratic.

The BigString ingester is only expected to operate within a single chunk at the time. It’s unclear precisely which operation triggers the quadratic behavior; ideally we should figure it out and resolve it with a more targeted fix.

In the meantime, a blunt stopgap fix is to force-transcode the input string to UTF-8 at the time the ingester is initialized. This unnecessarily wastes some (temporary) memory on holding the transcoded string, but it avoids the quadratic cliff.
2024-07-15 13:13:44 -07:00
Karoy Lorentey e004cd36fa Merge branch 'release/1.1' into merge.1.1→main
# Conflicts:
#	CMakeLists.txt
#	README.md
2024-02-07 17:35:40 -08:00
Karoy Lorentey 94cf62b3ba Merge pull request #352 from vanvoorden/vanvoorden/tree-dictionary-keys-equality
[TreeDictionary][Keys] Add Equatable and Hashable Conformance to TreeDictionary.Keys
2024-02-06 18:58:46 -08:00
Karoy Lorentey def1b63177 Merge pull request #355 from lorentey/release-1.1-prep
Release preparations for 1.1
2024-02-06 15:43:23 -08:00
Karoy Lorentey ffa4a58bc1 Update remaining copyright notices 2024-02-02 16:20:22 -08:00
Rick van Voorden 3c9df19f7d add collection equality benchmarks 2024-01-28 15:32:02 -08:00
Rick van Voorden 0e4014c468 tree dictionary keys equality 2024-01-28 13:49:26 -08:00
Karoy Lorentey 1a0ac8c06c Merge branch 'release/1.0' into release/1.1
# Conflicts:
#	Sources/DequeModule/CMakeLists.txt
#	Sources/DequeModule/Deque+Collection.swift
#	Sources/DequeModule/Deque+Sendable.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Sendable.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Sequence.swift
#	Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+Sendable.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+UnorderedView.swift
#	Sources/OrderedCollections/OrderedSet/OrderedSet+UnstableInternals.swift
2023-12-21 15:17:15 -08:00
Karoy Lorentey cd03e5b471 Merge branch 'release/1.1'
# Conflicts:
#	Sources/BitCollections/CMakeLists.txt
#	Sources/HashTreeCollections/CMakeLists.txt
2023-11-27 12:02:32 -08:00
Karoy Lorentey 33e2e610f5 Merge branch 'release/1.0' into release/1.1
# Conflicts:
#	Tests/_CollectionsTestSupport/MinimalTypes/MinimalDecoder.swift
2023-11-14 18:06:24 -08:00
Karoy Lorentey 10a01bd9fb Merge branch 'release/1.1'
# Conflicts:
#	Package.swift
2022-11-30 16:36:22 -08:00
Karoy Lorentey b8ef14f0c0 ShareableHashedCollections → HashTreeCollections 2022-11-28 21:35:37 -08:00
Karoy Lorentey ff85ea9e4f [Benchmarks] Split default huge library up into individual files, one per type 2022-11-09 19:34:58 -08:00
Karoy Lorentey b985c6bc1d [Benchmarks] Update/fix ShareableSet benchmarks 2022-11-07 18:10:16 -08:00
Karoy Lorentey e8fc3ee4cd [PersistentCollections] Rename to SharableHashedCollections
`PersistentSet` → `ShareableSet`
`PersistentDictionary` → `ShareableDictionary`
`PersistentCollections` → `ShareableHashedCollections`
2022-11-07 18:10:16 -08:00
Karoy Lorentey 898d3c9a51 [PersistentCollections] Doc & benchmark updates in preparation of API review 2022-10-31 16:45:42 -07:00
Karoy Lorentey a32048d44e Merge branch 'release/1.1' to ‘main’ 2022-10-28 18:21:18 -07:00
Karoy Lorentey 7dd47aa336 [Benchmark] Work on PeristentSet and PersistentDictionary benchmarks 2022-10-27 18:08:27 -07:00
Karoy Lorentey b1506b6225 [SortedCollections] Remove for now
These are still on track for 1.2.0, but I’ll need to bump them from
the release/1.1 branch.
2022-10-11 17:55:35 -07:00
Karoy Lorentey 33b759b842 [Heap] PriorityQueueModule → HeapModule 2022-10-09 15:44:44 -07:00
Karoy Lorentey 92d1d1297e [PersistentDictionary] Add a quick&dirty memory benchmark
The new executable target `memory-benchmark` collects some memory usage statistics and outputs average memory efficiency for a range of sizes in CSV format.

Bump required toolchain version for benchmarks to Swift 5.5.
2022-09-23 16:47:30 -07:00
Karoy Lorentey 9407eff8ca [PersistentDictionary] Add index striding benchmark 2022-09-23 11:15:46 -07:00
Karoy Lorentey 94d979c523 [Benchmarks] Fix header name in #include 2022-09-23 11:15:26 -07:00
Karoy Lorentey 12e3867ccb [Collections] Allow determining if internal checking is enabled
In the benchmark target, complain loudly if consistency checks
are enabled.
2022-09-19 21:25:07 -07:00
Karoy Lorentey b3227e63ea [PersistentCollections] New benchmarks measuring behavior on string data 2022-09-19 21:24:37 -07:00
Karoy Lorentey b263fb442e [Benchmarks] Move source files under Sources/
This eliminates the need to use path overrides.

Also, explicitly define a product for the “benchmark” executable.
2022-09-19 16:58:25 -07:00