mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Consider capacity >= mincapacity the _fastPath in requestUniqueMutableBackingBuffer.
This should allow us to better optimize repeated push/pop benchmarks. I didn't notice a performance change at the time I did this. I'm just putting it in as a hopefully obvious drive-by fix. Swift SVN r21429
This commit is contained in:
@@ -197,7 +197,10 @@ public struct _ContiguousArrayBuffer<T> : _ArrayBufferType {
|
||||
public mutating func requestUniqueMutableBackingBuffer(minimumCapacity: Int)
|
||||
-> _ContiguousArrayBuffer<Element>?
|
||||
{
|
||||
return isUniquelyReferenced() && capacity >= minimumCapacity ? self : nil
|
||||
if _fastPath(isUniquelyReferenced() && capacity >= minimumCapacity) {
|
||||
return self
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
public mutating func isMutableAndUniquelyReferenced() -> Bool {
|
||||
|
||||
Reference in New Issue
Block a user