attaswift/BTree 1202
Fast sorted collections for Swift using in-memory B-trees
attaswift/Attabench 1162
Microbenchmarking app for Swift with nice log-log plots
attaswift/BigInt 607
Arbitrary-precision arithmetic in pure Swift
Type-safe observable values and collections in Swift
Simple and secure hashing in Swift with the SipHash algorithm
objcio/OptimizingCollections 214
Home of my talk about Optimizing Collections in Swift
A double-ended queue type in pure Swift
An ID3v1/ID3v2 tag manipulation package written in pure Python 3
attaswift/alfred-swift-evolution 29
An Alfred workflow for looking up Swift evolution proposals
A proposal for adding diffing functionality to the Swift standard library
pull request commentapple/swift-driver
Decode path fields in `InterModuleDependencyGraph` as VirtualPaths
@swift-ci please test
comment created time in 14 minutes
PR opened apple/swift-driver
In the process of generating explicit dependency jobs, we end up spending a lot of time constructing VirtualPath objects from strings contained in the dependency graph, (It involves querying whether or not this string constitutes an absolute path, and breaking it down into components) which all add up to a large amount of string manipulation.
Instead, decode these strings into VirtualPath values directly, using the TextualVirtualPath wrapper.
pr created time in 14 minutes
push eventapple/swift-driver
commit sha f73ef69faa3e48f0ba47ba1de0deab6bb7367021
Display a list of driver modes in batch mode driver help. In the spirit of https://bugs.swift.org/browse/SR-7704, the legacy driver prints out a list of `MODES:` when invoked in "batch-mode": `swiftc --help`. This PR adds the same behaviour here.
commit sha fb31a042c1394c125a1ff03d4c26248d4edb1e2e
Merge pull request #436 from artemcm/BatchHelpModes Display a list of driver modes in batch mode driver help.
push time in 17 minutes
PR merged apple/swift-driver
In the spirit of https://bugs.swift.org/browse/SR-7704, the legacy driver prints out a list of MODES: when invoked in "batch-mode": swiftc --help.
This PR adds the same behaviour here.
pr closed time in 17 minutes
pull request commentapple/swift-driver
Display a list of driver modes in batch mode driver help.
Thanks, @cltnschlosser.
comment created time in 17 minutes
startederikzenker/hsm
started time in 20 minutes
pull request commentapple/swift-driver
Display a list of driver modes in batch mode driver help.
@swift-ci please test
comment created time in 27 minutes
PR opened apple/swift-driver
In the spirit of https://bugs.swift.org/browse/SR-7704, the legacy driver prints out a list of MODES: when invoked in "batch-mode": swiftc --help.
This PR adds the same behaviour here.
pr created time in 27 minutes
startedfrehberg/async-hsm
started time in 38 minutes
startedwebrtc-rs/webrtc
started time in an hour
PR opened apple/swift-algorithms
This PR adds implementations of index(_:offsetBy:) and index(_:offsetBy:limitedBy:) to the Product2 collection. There are ways to further reduce the amount of indices traversed, but this should perform well enough.
LIke Chain2, Product2's index offsetting behavior will now unfortunately perform slightly worse for non-random-access collections in specific scenarios, but there's not much we can do about that.
Checklist
- [x] I've added at least one test that validates that my change is working, if appropriate
- [x] I've followed the code style of the rest of the project
- [x] I've read the Contribution Guidelines
- [x] I've updated the documentation if necessary
pr created time in 2 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable+ public __consuming func Suffix(while predicate: (Element) throws -> Bool+ ) rethrows -> [Element] {+ var result = ContiguousArray<Element>()+ self.reverse()
I don’t believe reverse() can be used here (won’t compile), because it is a mutating function that reverses the elements of the collection in-place. This function, suffix(while:), isn’t mutating (and should remain that way), so it can’t use self.reverse() in its implementation.
It seems that you might have meant to use the non-mutating version of that function, reversed(), which returns a reversed collection:
for element in self.reversed() {
However, this comment likely won’t be applicable when changing the function to return SubSequence instead.
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Copyright (c) 2021 Apple Inc. and the Swift project authors
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable+ public __consuming func Suffix(while predicate: (Element) throws -> Bool+ ) rethrows -> [Element] {+ var result = ContiguousArray<Element>()+ self.reverse()
Consistent indentation
var result = ContiguousArray<Element>()
self.reverse()
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Copyright (c) 2021 Apple Inc. and the Swift project authors
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable+ public __consuming func Suffix(while predicate: (Element) throws -> Bool+ ) rethrows -> [Element] {+ var result = ContiguousArray<Element>()+ self.reverse()+ for element in self {+ guard try predicate(element) else {+ break+ }+ result.append(element)+ }+ result.reverse()+ return Array(result)
This double-reverse operation and converting to Array shouldn’t be necessary. The last index of the collection can be retrieved with endIndex, then walked backwards using index(before:).
This would be similar to the implementation of prefix(while:)<sup>1</sup>, but a little bit trickier. Since endIndex is beyond the subscript-able range of a collection, the index has to be moved backwards before using it to subscript the collection, and ensuring it doesn’t go before the first element (start index). In SuffixTests.swift, I made some comments about test cases that will be important for ensuring that these cases are accounted for.
- https://github.com/apple/swift/blob/main/stdlib/public/core/Collection.swift#L1330
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++import XCTest+import Algorithms++final class SuffixTests: XCTestCase {+ + func testSuffix() {+ let a = 0...10+ XCTAssertEqualSequences(a.suffix(while: { $0 > 5 }), (6...10))+}
}
}
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++import XCTest+import Algorithms++final class SuffixTests: XCTestCase {+
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++import XCTest+import Algorithms++final class SuffixTests: XCTestCase {
Tests should be added to handle:
- Empty input
- Empty output (predicate doesn’t match the first element)
- Predicate matches just the first element
- Predicate matches all elements
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)
// suffix(while:)
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable
Documentation should be added. Mirroring the documentation for prefix(while:) would be a good start.
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable+ public __consuming func Suffix(while predicate: (Element) throws -> Bool+ ) rethrows -> [Element] {
Can this return SubSequence instead?
prefix(while:) on Collection returns a SubSequence.<sup>1</sup>
- https://github.com/apple/swift/blob/main/stdlib/public/core/Collection.swift#L1328
comment created time in 3 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable+ public __consuming func Suffix(while predicate: (Element) throws -> Bool
public __consuming func suffix(
while predicate: (Element) throws -> Bool
comment created time in 4 hours
Pull request review commentapple/swift-algorithms
+//===----------------------------------------------------------------------===//+//+// This source file is part of the Swift Algorithms open source project+//+// Copyright (c) 2020 Apple Inc. and the Swift project authors+// Licensed under Apache License v2.0 with Runtime Library Exception+//+// See https://swift.org/LICENSE.txt for license information+//+//===----------------------------------------------------------------------===//++//===----------------------------------------------------------------------===//+// Suffix(while:)+//===----------------------------------------------------------------------===//++extension BidirectionalCollection {+ @inlinable+ public __consuming func Suffix(while predicate: (Element) throws -> Bool
public __consuming func suffix(while predicate: (Element) throws -> Bool
comment created time in 4 hours
pull request commentapple/swift-syntax
Minor internal API improvements
@swift-ci Please test
comment created time in 4 hours
PR opened apple/swift-syntax
Two minor internal API improvements:
- Remove
advancedToEndOfChildrenThese methods are not used anywhere and are potentially incorrect (indexInParentshould probably be initialized withraw.numberOfChildren - 1). Remove the until we really need them - Rename
advancedBySibling/reversedBySiblingtoadvancedBy/reversedByWe are not actually advancing by a sibling but just by a node, simplify the method name to reflect this.
pr created time in 4 hours
PR opened apple/swift-algorithms
<!-- Thanks for contributing to Swift Algorithms!
- [x] I've completed this task
- [ ] This task isn't completed
#62
Checklist
- [ ] I've added at least one test that validates that my change is working, if appropriate
- [ ] I've followed the code style of the rest of the project
- [ ] I've read the Contribution Guidelines
- [ ] I've updated the documentation if necessary
pr created time in 5 hours
issue closedapple/swift-algorithms

The function that was used is unknown on my side ? I use Swift 5.3 and Xcode 12.3, macOS 11.1
closed time in 6 hours
nilsnilsnils