woodcrust
(Ole G )
September 19, 2018, 4:43pm
1
Hello guys, please tell me what happened with "swift 4.2" and why each new "swift" release slower than before ? It really frightens away from using "swift" in production on server side =(
The write to file on linux from 0,54 seconds(swift 4.1.3 and below) became 6 seconds(swift 4.2)
opened 03:04AM - 18 Sep 18 UTC
bug
Foundation
performance
| | |
|------------------|-----------------|…
|Previous ID | SR-8782 |
|Radar | rdar://problem/44562009 |
|Original Reporter | woodcrust (JIRA User) |
|Type | Bug |
Attachment: [Download](https://user-images.githubusercontent.com/2727770/164962937-518c22d0-cb3e-45c0-b693-646a3e3b0cd1.gz)
<details>
<summary>Environment</summary>
Linux megatron 4.15.0-23-generic \#25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
</details>
<details>
<summary>Additional Detail from JIRA</summary>
| | |
|------------------|-----------------|
|Votes | 3 |
|Component/s | Foundation |
|Labels | Bug, Performance |
|Assignee | @millenomi |
|Priority | Medium |
md5: 41e66d0b088a646c5617e609a284868a
</details>
**Issue Description:**
Hello, sorry for my very bad english...
I like "swift" so much. But tell me please, why with each update version "swift" becomes slower ? I now afraid what next update kill "swift". Why the write to file on linux from 0,54 seconds(swift 4.1.3 and below) became 6 seconds(swift 4.2) (screenshots below) and the write to file on macOS from 0,3 seconds became 2 seconds ?
code: https://github.com/woodcrust/puffin_bench/blob/master/source/3-writeToFile/swift3.swift
opened 02:10AM - 24 May 18 UTC
closed 03:43PM - 23 Mar 19 UTC
bug
performance
Standard Library
| | |
|------------------|-----------------|…
|Previous ID | SR-7759 |
|Radar | None |
|Original Reporter | woodcrust (JIRA User) |
|Type | Bug |
|Status | Closed |
|Resolution | Done |
Attachment: [Download](https://user-images.githubusercontent.com/2727770/164962739-3f97107d-93d2-499e-946a-16e569a6f901.gz)
<details>
<summary>Additional Detail from JIRA</summary>
| | |
|------------------|-----------------|
|Votes | 2 |
|Component/s | Standard Library |
|Labels | Bug, Performance |
|Assignee | None |
|Priority | Medium |
md5: 4069bbc8d4757d9becf5310fc5d09c1f
</details>
**Issue Description:**
Hello, my name is Oleh. My english is very bad =(
I am seeing a decline in performance between versions like 4.0.3 and 4.1.1. Me very interested, why ? I am testing this on linux os and other computers with this code:
``` java
func shellsSort<T : Comparable>(_ arr: inout [T]) {
let n = arr.count
var gap = n/2
var i = 0
var j = 0
var temp : T
while gap > 0 {
i = gap
while i < n {
temp = arr[i]
j = i
while (j >= gap && arr[j - gap] > temp) {
arr[j] = arr[j - gap]
j = j - gap
}
arr[j] = temp
i = i + 1
}
gap = gap/2
}
}
var a = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
var c = 0
while (c < 10000000) {
shellsSort(&a)
a = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
c = c + 1
}
```
And I see what the regression of performance in 4.1.1 version equal \~74% then in versions 4.0.3, 3.0.1 etc
for example
4.0.3 - 1,66 sec
4.1.1 - 2,89 sec
Please tell me why ?
Joe_Groff
(Joe Groff)
September 19, 2018, 5:01pm
2
Thanks for reporting these bugs! The second one looks like it might be an issue specific to top-level code; wrapping your benchmark code in a function brings performance back in line with 4.0 for me ([SR-7759] Swift 4.1.1 performance regression · Issue #50298 · apple/swift · GitHub ).
The first one looks like it might be a Foundation-specific regression; if you have time to compare performance using POSIX file APIs directly, that might be interesting. cc @millenomi
5 Likes
woodcrust
(Ole G )
September 24, 2018, 12:43am
4
1 Like
Joe_Groff
(Joe Groff)
September 24, 2018, 4:33pm
6
Thanks. It looks like there's some added overhead even in the POSIX case that we should look into. @Tony_Parker or someone else from the Foundation team would probably want to look into why the 4.2 Foundation is so much slower.
Thanks for the report. I've assigned your bug to @millenomi to take a look at.
hello, compare with swift 5 - development.
Performance is even lower than it was in version 4.2
4.0.3 - 0.53 sec
4.2 - 6.30 sec
5-dev - 12.47 sec
2 Likes
Joe_Groff
(Joe Groff)
March 20, 2019, 4:45pm
9
cc @Philippe_Hausler , maybe this has something to do with the Data refactoring?
1 Like
On macos with Swift 5 mid 2015 2,5 GHz Intel Core i7 - result is better
But on Linux with release swift 5 still same very bad result as on above screenshot with Swift 5 - dev