Why Swift is 100 times slower than C in this image processing test?

This question already has an answer here:

  • Swift performance: sorting arrays 8 answers

  • Building with:

    xcrun swift -Ofast test.swift -o test

    I'm getting times of:

    real    0m0.052s
    user    0m0.009s
    sys 0m0.005s
    

    Let's just concentrate on the answer to the question, which started with a "Why": Because you didn't turn optimisations on, and Swift relies heavily on compiler optimisation.

    That said, doing image processing in C is truly daft. That's what you have CGImage and friends for.

    链接地址: http://www.djcxy.com/p/5420.html

    上一篇: 按值排列二维数组

    下一篇: 为什么Swift在这个图像处理测试中比C慢100倍?