I developed a C program aimed to load data from a big file (several gigabytes), using threads to get faster. The code executes as fast as expected when I run it from the Terminal with gcc, it gets faster with more threads, until it reaches a maximum performance in terms of execution time. When I add the code to my Swift project in Xcode, exactly the same C code, and run it, the performances are way different. With one thread it is approximately the same execution time, but with more threads the execution time increase drastically.
What can cause this behaviour ? How to handle it ?
I use the default compiler for C/C++/Objective-C Apple Clang. I am under Mac M1 ARM.
user25020188 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.