I wrote two programs that computes area of a function with a certain number of rectangles using Riemann sums, one is written in Go and the other with C++.
The objective was to measure execution time and see which language is the faster on multithreading.
I ran the program on a 32-cores server (Dual Intel Xeon) using a bash script to run it with 1, 2, 4, 8, 16 and 32 threads. The script use time --format %U
to get the execution time .
But as you can see in the results running the Go version using 1 core is 1.19 seconds and with 32 cores it's 1.69 seconds ! I thought using more cores would have made computations faster...
Did I made an error writing my programs ? Is the measure of time accurate ? Or maybe the results are good but how ?
Thank you in advance for your answers !
Aucun commentaire:
Enregistrer un commentaire