Commit Graph
22 Commits
Author SHA1 Message Date
inju2403 86ddbd9705 [OrderedCollections] OrderedSet.reverse(): update the hash table in place
Reversing an ordered set is a deterministic permutation: the element at offset `i` moves to offset `count - 1 - i`. Hash values are unaffected, so every element stays in its current bucket and only the stored offset needs to be flipped. `reverse()` was instead regenerating the whole hash table from scratch, rehashing every element -- exactly what the existing `// FIXME: Update hash table contents in place.` called out.

Replace `_regenerateHashTable()` with an in-place offset flip (`v -> count - 1 - v`) over the table's buckets, reusing the same bucket-walk idiom as `adjustContents` and `swapBucketValues`. This drops all hash recomputation and the table reallocation.
2026-06-12 08:57:42 +09:00
Karoy Lorentey 0fa494d3a8 [OrderedCollections] Minor fixes in _HashTable.UnsafeHandle 2026-04-30 15:29:25 -07:00
Karoy Lorentey ee9808c72f [Dequemodule, OrderedCollections] Avoid using floating point arithmetic 2026-03-06 18:19:16 -08:00
Karoy Lorentey 1c69635852 Add SPDX-License-Identifier tags 2026-03-05 19:39:24 -08:00
Karoy Lorentey d9b09ecde8 Update copyright dates 2026-03-05 19:39:20 -08:00
Karoy Lorentey ebaef60379 [OrderedCollections] Fix doc typo 2026-02-03 13:22:00 -08:00
Karoy Lorentey 0f73f0ace7 Merge branch 'release/1.2'
# Conflicts:
#	.github/workflows/pull_request.yml
#	.swiftci/5_10_ubuntu2204
#	.swiftci/5_7_ubuntu2204
#	.swiftci/5_8_ubuntu2204
#	.swiftci/5_9_ubuntu2204
#	.swiftci/nightly_6_0_macos
#	.swiftci/nightly_6_0_ubuntu2204
#	.swiftci/nightly_main_macos
#	.swiftci/nightly_main_ubuntu2204
2025-05-20 11:13:32 -07:00
Karoy Lorentey 2709b96947 Minor code style updates 2024-11-18 13:59:31 -08:00
David Nadoba 13245da5f5 Optimize unspecialized OrderedSet.init and OrderedSet.firstIndex(of:) 2024-11-18 13:59:23 -08:00
Karoy Lorentey ad79ce5b6a Merge branch 'release/1.1'
# Conflicts:
#	.swiftci/5_10_ubuntu2204
#	.swiftci/5_7_ubuntu2204
#	.swiftci/5_8_ubuntu2204
#	.swiftci/5_9_ubuntu2204
#	.swiftci/nightly_6_0_macos
#	.swiftci/nightly_6_0_ubuntu2204
#	.swiftci/nightly_main_macos
#	.swiftci/nightly_main_ubuntu2204
2024-06-05 10:28:47 -07:00
Karoy Lorentey 35d5746117 Rename _CollectionsUtilities to InternalCollectionsUtilities
We are forced to do this due to an Xcode issue (#364) with underscored module names.

This module remains unstable, despite the removal of the underscore. Directly importing it from outside the package remains unsupported. This module and/or its entire contents may go away or change in incompatible ways in any future swift-collections release.
2024-05-29 14:00:13 -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
Dimitris Apostolou 7539583245 Fix typos
# Conflicts:
#	Sources/SortedCollections/BTree/_BTree+BidirectionalCollection.swift
#	Sources/SortedCollections/BTree/_BTree+UnsafeCursor.swift
#	Sources/SortedCollections/BTree/_BTree.Builder.swift
#	Sources/SortedCollections/BTree/_BTree.swift
#	Sources/SortedCollections/BTree/_Node.Splinter.swift
#	Sources/SortedCollections/BTree/_Node.Storage.swift
#	Sources/SortedCollections/BTree/_Node.UnsafeHandle+Insertion.swift
#	Sources/SortedCollections/BTree/_Node.swift
#	Tests/SortedCollectionsTests/BTree/Node+Join Tests.swift
2024-02-06 15:52:26 -08:00
Dimitris Apostolou ab744afc39 Fix typos 2024-02-04 20:35:42 +02:00
Karoy Lorentey 64b286d63d [OrderedCollections] Update copyright notices 2024-02-02 16:20:21 -08:00
Karoy Lorentey 3f4d8f9912 Merge branch 'release/1.1' into 'main'
# Conflicts:
#	Package.swift
2023-04-24 14:24:15 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Nick Kohrn 18c4f6dc5a [Hashtable] Minor documentation fix (typo) 2022-11-12 21:49:19 -05:00
Karoy Lorentey 7143421800 [OrderedCollections] Add missing Custom[Debug]StringConvertable conformances, review existing ones
Add `Custom[Debug]StringConvertible` conformance on:

- `OrderedDictionary.Values`
- `OrderedDictionary.Elements.Subsequence`
- `OrderedSet.SubSequence`
2022-10-20 17:14:52 -07:00
Karoy Lorentey 3d11356006 [OrderedSet] Move RAC utilities to _CollectionsUtilities module 2022-10-09 20:11:51 -07:00
Karoy Lorentey ee1b2de06e [OrderedCollections] Force-inline all _modify accessors 2022-08-31 15:31:42 -07:00
Karoy Lorentey a2bcac435f Initial import.
Introduce OrderedCollections module
2021-04-05 09:41:00 -07:00