[SR-13375] Performance regression on master: swift_COWSanityChecksEnabled #55815
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
```
Docker: swift:nightly-bionic (ImageId: 6adf11873420)
Swift version 5.3-dev (LLVM 03a20a7, Swift f9e54e1)
Target: x86_64-unknown-linux-gnu
Docker: swift:nightly-5.3-bionic (ImageId: 702e3f647de8)
Swift version 5.3-dev (LLVM 8cbcb68, Swift fc45397)
Target: x86_64-unknown-linux-gnu
```
Additional Detail from JIRA
md5: babde2cb25f7247cf438f2a66d96c9a7
cloned to:
Issue Description:
Hi, I can see a performance regression between master and the 5.3 branch. I noticed the difference when I ran some tests for my base64 library (The implementation is not complex and the only dependency is the Standard Library).
https://github.com/fabianfett/swift-base64-kit
Code:
https://github.com/fabianfett/swift-base64-kit/blob/35d3358a867e954f8f87769df3f9ae2eb6d9da14/Sources/Base64Kit/Base64.swift#L149
For the tests I used the Docker images from tonight:
```
Docker: swift:nightly-bionic (ImageId: 6adf11873420)
Swift version 5.3-dev (LLVM 03a20a7, Swift f9e54e1)
Target: x86_64-unknown-linux-gnu
Docker: swift:nightly-5.3-bionic (ImageId: 702e3f647de8)
Swift version 5.3-dev (LLVM 8cbcb68, Swift fc45397)
Target: x86_64-unknown-linux-gnu
```
I ran the tests (`swift run -c release`) with the two image above on my main branch:
master:
```
Number of invocations: 1000000
Encoding
Foundation | took: 0.5717020034790039s
Base64 | took: 39.250354051589966s
Decoding
Foundation | took: 1.2178590297698975s
Base64 | took: 26.803733944892883s
```
5.3-branch:
```
Encoding
Foundation | took: 1.552825927734375s
Base64 | took: 0.8509190082550049s
Decoding
Foundation | took: 5.576089024543762s
Base64 | took: 0.9508119821548462s
```
While the Foundation implementation has gotten significantly faster �, something must have change under the hood that makes my implementation a lot slower. I wanted to look into it with Instruments.app, but sadly I couldn't install the toolchain from master (using the swift.org download).
I hope that helps, if you have any questions, please reach out.
The text was updated successfully, but these errors were encountered: