Surge is a Swift library that uses the Accelerate framework to provide high-performance functions for matrix math, digital signal processing, and image manipulation.
Accelerate exposes SIMD instructions available in modern CPUs to significantly improve performance of certain calculations. Because of its relative obscurity and inconvenient APIs, Accelerate is not commonly used by developers, which is a shame, since many applications could benefit from these performance optimizations.
Surge aims to bring Accelerate to the mainstream, making it as easy (and nearly as fast, in most cases) to perform computation over a set of numbers as for a single member.
Though, keep in mind: Accelerate is not a silver bullet. Under certain conditions, such as performing simple calculations over a small data set, Accelerate can be out-performed by conventional algorithms. Always benchmark to determine the performance characteristics of each potential approach.
Curious about the name Surge? (And Jounce?)
Back in the mid 90's, Apple, IBM, and Motorola teamed up to create
AltiVec (a.k.a the Velocity Engine),
which provided a SIMD instruction set for the PowerPC architecture.
When Apple made the switch to Intel CPUs,
AltiVec was ported to the x86 architecture and rechristened
Accelerate.
The derivative of Accelerate (and second derivative of Velocity)
is known as either jerk, jolt, surge, or lurch;
if you take the derivative of surge,
you get the jounce ---
hence the name of this library and its parent organization.
Installation
The infrastructure and best practices for distributing Swift libraries are currently in flux during this beta period of Swift & Xcode. In the meantime, you can add Surge as a git submodule, drag the Surge.xcodeproj file into your Xcode project, and add Surge.framework as a dependency for your target.
Surge uses Swift 5. This means that your code has to be written in Swift 5 due to current binary compatibility limitations.
License
Surge is available under the MIT license. See the LICENSE file for more info.
The Tidelift Subscription provides access to a continuously curated stream of human-researched and maintainer-verified data on open source packages and their licenses, releases, vulnerabilities, and development practices.