News for hackers. Stuff that matters.
Re:Swift Programming Language Evolution by thomasahle on Monday May 09, 2016 @11:40AM (#11660623)
By http://benchmarksgame.alioth.debian.org/u64q/which-programs-... Swift's performance is similar to Java's, but quite a bit faster when working with many objects: http://benchmarksgame.alioth.debian.org/u64q/swift.html On a few benchmarks it's faster than C as well: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan... though not most.

I suppose they were able to do the binary-tree benchmark so much better than Java, because Swift supports 'UnsafeMutablePointers': http://benchmarksgame.alioth.debian.org/u64q/program.php?tes...

Edit: This Quora question mentions the performance of Swift before and after unsafe programs were included: https://www.quora.com/In-terms-of-performance-speed-is-Swift... The memory safe version used to be about 24x slower than C.

Re:Swift Programming Language Evolution by kzaher on Monday May 09, 2016 @12:18PM (#11660940)
I don't think these benchmarks are realistic. Yes, you can use UnsafePointers, but that's not the real world case. ARC, runtime generics and structs have a huge cost in real world programs.

Swift is unfortunatelly usually an order of magnitude slower then Java and C# in real world according to last benchmarks I've made. I'm hoping that will change because I really love Swift.

Re:Swift Programming Language Evolution by igouy on Monday May 09, 2016 @01:48PM (#11661681)
Please contribute Swift programs that you think are "the real world case":

http://benchmarksgame.alioth.debian.org/play.html

Re:Swift Programming Language Evolution by hellofunk on Monday May 09, 2016 @01:07PM (#11661355)
Agreed. Swift is quite high-level compared to C or C++, for examples. As with any languages, there are tradeoffs with performance.
Re:Swift Programming Language Evolution by igouy on Monday May 09, 2016 @12:14PM (#11660907)
>> I suppose they were able to do the binary-tree benchmark so much better than Java, because

… because it's faster to use a memory pool than GC for that … ditto C Rust Ada Fortran C++ …

http://benchmarksgame.alioth.debian.org/u64q/performance.php...

Re:Swift Programming Language Evolution by igouy on Monday May 09, 2016 @01:46PM (#11661660)
>> Edit: This Quora question mentions the performance of Swift before and after unsafe programs were included

That Quora answer makes claims which are not true.

The Swift benchmarks game programs were always compiled with -Ounchecked (since Dec 7 2015).

The before was naive transliterations (from other programming languages) of single-core programs -- just to demonstrate that Swift was installed.

The after was someone doing the work and contributing programs written for Swift and written for multi-core.