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

xMatters delivers integration-driven collaboration that relays data between systems, while engaging the right people to proactively resolve issues. Read the Monitoring in a Connected Enterprise whitepaper and learn about 3 tools for resolving incidents quickly.

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?

3 Steps to Monitoring in a Connected Enterprise. Check out xMatters.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}