Alejandro Martinez

BlogPodcastPortfolioΒ Youtube

24 May, 2016πŸ”— Linked pageDevelopmentπŸ• 1min read

Matt Gallagher on C-level performance in Swift

Getting C-level performance in Swift for numerical algorithms is quirky but not particularly difficult. If you limit yourself to value types (no classes or existentials), use unsafe pointers and tuples instead of arrays, use overflow discarding operators &+/&-/&* instead of normal +/-/*, use while or repeat/while for your loops, then Swift and clang C will generally compile to identical instructions.

It’s not as though C is maximally performant without a little contortion. Using int types for indexes on 64-bit systems should be avoided and so should common idioms like inline use of the ++ postincrement operator.

πŸ‘‰πŸ» If you have any feedback you can reach me at alexito4

Save web developmentThe state of Swift scripting

Alejandro Martinez
alexito4@gmail.com

Buka pintu

alexito4
alexito4