Business Card Ray Tracer: Go vs C++(kidoman.com)
kidoman.com
Business Card Ray Tracer: Go vs C++
https://kidoman.com/programming/go-getter.html?noreaally
1 comments
I have rerun the benchmarks now after optimizing the C++ version the best "I" could:
https://kidoman.com/programming/go-getter-part-2.html
https://kidoman.com/programming/go-getter-part-2.html
IIUC, the diff b/t go and most languages is that go spawns threads through a slicing mechanism to leverage multiple cores, right?! That's why the go version speeds up when run on multiple-core systems...right?
So, I added pthreads to the ray-tracer program: http://pastebin.com/6V5JYyZG
Included in the paste are the execution times on my lowly dual-core laptop. Spawning more threads speeds up the program. I would be curious to see how it scales to more cores on modern CPUs. If you have a chance, won't you please give it a try on your system and let me know how changing the number of threads affects execution time?
For anyone who wants to try pthreads in C, the simplest example and progressions I could find were here: http://cs.gmu.edu/~white/CS571/Examples/pthread_examples.htm...
So, I added pthreads to the ray-tracer program: http://pastebin.com/6V5JYyZG
Included in the paste are the execution times on my lowly dual-core laptop. Spawning more threads speeds up the program. I would be curious to see how it scales to more cores on modern CPUs. If you have a chance, won't you please give it a try on your system and let me know how changing the number of threads affects execution time?
For anyone who wants to try pthreads in C, the simplest example and progressions I could find were here: http://cs.gmu.edu/~white/CS571/Examples/pthread_examples.htm...
C++ multi threaded: https://kidoman.com/programming/go-getter-part-3.html
I am happy to rerun the benchmarks (single threaded and multi threaded) with a optimized C++ version. Sadly, been a while since I last worked on C++
The base C++ version, for reference: https://gist.github.com/kid0m4n/6680629
But its never going to be apples-to-apples comparison. Given the different feature sets of either platform
But this definitely shows that Go performance is in the same ballpark though.
The base C++ version, for reference: https://gist.github.com/kid0m4n/6680629
But its never going to be apples-to-apples comparison. Given the different feature sets of either platform
But this definitely shows that Go performance is in the same ballpark though.
The Go version is 229 lines (6.5x as long) and 4255 bytes long (3.2x as long). Fit that on a business card...
Your title should be "Go program optimized for speed faster than C++ program optimized for code size" and you should stop trying provoke people with false comparisons.