mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[stdlib] Switch to a linear-space variant of Myers diffing (#83212)
This changes the implementation for `Collection.difference(from:)` to use a linear-space complexity variation of the same Myers algorithm. The new version is similar in execution time to the existing one, but should alleviate memory pressure when diffing collections where the number of differences approaches the size of the collection. While the new algorithm returns a set of changes that is the same size as the previous version, the specific changes are not guaranteed to be the same. rdar://155829876
This commit is contained in:
@@ -52,12 +52,12 @@ public let benchmarks = [
|
||||
BenchmarkInfo(
|
||||
name: "Diffing.Large.Similar",
|
||||
runFunction: { diff($0, from: bigUnabridgedLorem, to: bigLoremIpsum) },
|
||||
tags: t,
|
||||
tags: t + [.skip],
|
||||
setUpFunction: { blackHole((bigUnabridgedLorem, bigLoremIpsum)) }),
|
||||
BenchmarkInfo(
|
||||
name: "Diffing.Large.Disparate",
|
||||
runFunction: { diff($0, from: bigNumbersAndSymbols, to: bigAlphabets) },
|
||||
tags: t,
|
||||
tags: t + [.skip],
|
||||
setUpFunction: { blackHole((bigNumbersAndSymbols, bigAlphabets)) }),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user