Swift Performance above 4.0.3 (swift 4.2)

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)

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

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).

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

@Joe_Groff
Hello! About [SR-8782] swift 4.2 - the write to file from 0,54 seconds became 6 seconds (the "swift" come back to regression again) · Issue #3635 · apple/swift-corelibs-foundation · GitHub again...
You asked me to do the posix write to file: puffin_bench/swift3-posix.swift at master · nerzh/puffin_bench · GitHub

result:

1 Like

@Joe_Groff

And swift 4.2.0

1 Like

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 :crazy_face:
4.0.3 - 0.53 sec
4.2 - 6.30 sec
5-dev - 12.47 sec

2 Likes

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