This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Accelerate | |
import XCTest | |
let array = Array(stride(from: 0.0, to: 50000.0, by: 1)) | |
let array2 = Array(stride(from: 0.0, to: 50000.0, by: 1)) | |
let array3 = Array(stride(from: 0.0, to: 50000.0, by: 1)) | |
class MathTests: XCTestCase { | |
func testMeanSwifty() { | |
measure { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func multiply(_ array: [Double]) -> [Double] { | |
// Allocate memory for the output array | |
let output = UnsafeMutablePointer<Double>.allocate(capacity: array.count) | |
// Make sure we free up the memory once we're done | |
defer { | |
output.deinitialize(count: array.count) | |
output.deallocate() | |
} | |
NewerOlder