I have been doing a lot of implementations in C language for my research over the past two years. I chose C over other languages because of the general notion that C code runs faster compared to other popular programming languages such as Java and Python. However, I myself did not do any experiments to confirm that claim even though I was always curious about how fast C is (or is C actually the fastest). Finally, I decided to run some experiments to compare the performance of C, Java, and Python. This article is about the experiments that I carried out and the obtained results.
I decided to do matrix multiplication using all three languages. The matrices are of size 2048 x 2048 (i.e. 8,589,934,592 multiplication and addition operations each) and I populated them with random values between 0.0 and 1.0 (the impact of using random values rather than using the exact same matrices for all three languages is negligible). I ran each experiment five times and calculated the average running time.
#python #java #c #programming #computer-science