Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Swift Performance: Sorting Arrays

DZone's Guide to

Swift Performance: Sorting Arrays

· Performance Zone ·
Free Resource

Sensu is an open source monitoring event pipeline. Try it today.

Ever since Apple announced its new programming language, Swift, at the WDCC last week, programmers and non-programmers alike have been digging their fingers into the particulars to find out what makes it tick. One StackOverflow member ran a series of tests  on sorting arrays to pit Swift against other languages like C++ and Python. 

The whole point of Swift is that we have the safety nets in place. Of course the safety nets have some impact on the performance, but they should not make the programs 100 times slower. Remember that Java already checks for array bounds, and in typical cases the slowdown is by a factor much less than 2. And in Clang and GCC we have got -ftrapv for checking (signed) integer overflows, and it is not that slow, either.

Hence the question: how can we get a reasonable performance in Swift without losing the safety nets?

Check out the process and community discussion over at StackOverflow. What are your experiences with Swift so far?

Sensu: workflow automation for monitoring. Learn more—download the whitepaper.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}