Daniel Lemire's blog

, 4 min read

Can Swift code call C code without overhead?

6 thoughts on “Can Swift code call C code without overhead?”

  1. qznc says:

    I would assume swift test is for unit tests, not benchmarks. Why would you think benchmarks are part of the tests?

    1. I would also prefer to have benchmarks separated from unit tests…
      I think Swift thinks of these as “performance tests”.

      But this aside, I’d like to run my unit tests with both release and debug binaries.

  2. Pablo Guerrero says:

    Have you tried to write high-performance code with Rust? I think it could be faster than swift, and it should also have zero overhead calling C code if needed.

  3. jld says:

    Since you can also have garbage collection for C and C++ there is little reason to bother with “shiny” new languages which bring brand new bugs and poor libraries.
    http://www.hboehm.info/gc/

    1. I like C and C++, a lot.

      But first, they are moving targets, see http://lemire.me/blog/2016/09/14/the-new-c-standards-are-worth-it/ Standing still is just not an option in computing.

      Second, these new shiny languages come with nice features like standard and universal tools to test, build and manage dependencies. Also they tend to do away with undefined behaviours. Garbage collection is just one of many small features.

      Third, there are entire platforms where some language dominates. You can’t do web without JavaScript. You can’t keep doing iOS without Swift. You can’t do Android without Java. You probably shouldn’t do video games without C++.

  4. nick patel says:

    nice post