Interface and Application Programming

This week, we will compare tools for application and interface programming.

Programs now have become an integrated part of our day to day life. Everything is automated now and connected with Iot.
Amongst the programmers the most popular programming languages are c++ ; Java ; Python. C++ being a fast and compiled programming language has gained popularity and is the first programming language that a programmer learns.
Java is popular due to its platform independence and huge number of desktop applications are developed using Java.
Python is an interpreted programming language, it is a modern programming language and it is a fast type language.


Performance comparison

Experiment: The idea is 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). Each experiment will be executed five times and calculated the average running time.

C code:

Java code:




Python code:


Compilation and run commands:



Results:



It was not expected that Java was faster than C. This occurs because Java always uses code optimization, which is not the case of GCC (the compiler used for C code).
Compiling C with optimization:



New results: