Swift Performance above 4.0.3 (swift 4.2)

linux
performance
foundation

(Ole G ) #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)
https://bugs.swift.org/browse/SR-8782
https://bugs.swift.org/browse/SR-7759


(Joe Groff) #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 (https://bugs.swift.org/browse/SR-7759?focusedCommentId=39912&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-39912).

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


(Ole G ) #3

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 (https://bugs.swift.org/browse/SR-7759?focusedCommentId=39912&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-39912).

You right! its work :eyes::+1:


(Ole G ) #4

@Joe_Groff
Hello! About https://bugs.swift.org/browse/SR-8782 again...
You asked me to do the posix write to file: https://github.com/woodcrust/puffin_bench/blob/master/source/3-writeToFile/swift3-posix.swift

result:


(Ole G ) #5

@Joe_Groff

And swift 4.2.0


(Joe Groff) #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.


(Tony Parker) #7

Thanks for the report. I've assigned your bug to @millenomi to take a look at.