使用Release build,將一張512 x 512 Pixel 的圖片做二值化,並計算所花的時間(越少越快)
執行速度:
Swift > "Swift with Objective-C Bridge" > Objective-C ,果然有跟之前看到文章效能測試吻合!
測試的順序:
1.Swift with Objective-C Bridge (最快約 0.003 ms)
2.Swift (最快約 0.002 ms)
3.Objective-C (最快約 0.005 ms)
Github:
https://github.com/Bosian/Swift-vs-Bridge-vs-Objc-ImageProcessing
參考資料:
http://mhorga.org/2015/10/05/image-processing-in-ios.html
http://mhorga.org/2015/10/12/image-processing-in-ios-part-2.html
http://mhorga.org/2015/10/19/image-processing-in-ios-part-3.html
http://stackoverflow.com/questions/32441432/release-unsafemutablebufferpointeruint8-values
http://sketchytech.blogspot.tw/2014/09/unsafe-pointers-in-swift-how-to-build.html
https://onevcat.com/2015/01/swift-pointer/
http://swifter.tips/pointer-memory/
http://stackoverflow.com/questions/25127700/two-dimensional-array-in-swift
留言列表