So, I have two programs that do the same thing. I tried parallelizing them using pthreads for the C version and using a rust library for the rust one.
Here are the links to both versions:
C version:
https://gist.github.com/nyeecola/daf6a1d41c1aa8273403cd7e0459aac9
Rust version:
https://gist.github.com/nyeecola/8f8c65c60e79d9866b4f559a515a5659
These are the results that I got from it:
Running on 1 thread:
- C version: 80-90 fps
- Rust version: 110-130 fps
Running on 4 threads:
- C version: 370-420 fps
- Rust version: 1400-1600 fps
What is causing this drastic difference? I guess it may be that I'm not using a thread pool for the C version and the threads keep getting created and joined? I tried implementing a thread pool but I had some trouble, will keep trying though.
Is there any other thing that I'm missing? Any tips or ideas?