The Accelerate framework contains many high performance matrix math, linear algebra, image processing, and digital signal processing functions, but suffers from a somewhat unusual syntax when compared to other iOS frameworks. Last month I mentioned a library inspired by Python’s NumPy that uses the accelerate framework for performing math called Swix.
Here’s a nice Swift based wrapper library for the Accelerate framework from Matt Thompson called Surge. Surge wraps the unusual syntax of many Accelerate functions into a nice simple syntax.
This performance comparison from the readme :
let numbers: [Double] = ... // 1000000 Elements
var sum: Double = 0.0
// Naïve Swift Implementation
sum = reduce(numbers, 0.0, +) // Time: 5.700 sec (2% STDEV)
// Surge Implementation
sum = Surge.sum(numbers) // Time: 0.001 sec (17% STDEV)
Resulted in a performance increase of 5,700x speed increase with the size of numbers at 1,000,000 elements using Surge vs. the native Swift math implementation.
You can find Surge on Github here.
If you’re unfamiliar with the Accelerate framework this is a nice introductory video from WWDC 2013 Apple developer login required.
A great library for utilizing the accelerate framework.
Thanks to Chris for the submission.
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.