Double For Loop Performance Javascript vs Java vs Python

Flabo Education 

Topics: Double For Loop, Programming, Software

Transcript Summary

Double For Loop tests for JavaScript, Python, and Java are discussed. JavaScript is a scripting programming language that enables you to create dynamically updating content, control multimedia, and animate images. Python is a general-purpose, versatile, and high-level programming language that is used in web development, data science, and creating software prototypes. Java is an object-oriented programming language that produces software for multiple platforms. The presenter discusses the process of a double for loop test for JavaScript, Python and Java.  

A double for loop test is a test in which nested for loops run to a fixed amount of length. In this particular program, N is set to 7000, which means that the outer loop would iterate to 7000 and the inner loop would also iterate to 7000. In this particular case, the line in the program would be executed 49 million times. The same program is written in JavaScript and Java. To run them, the three programs need to run one after the other. The presenter demonstrates the three programs in the three languages provided. In the demonstration, the Python program finished at about 4.8 seconds, the JavaScript version of the program finished in about 529 milliseconds, or about half a second, and Java finished in about 876 milliseconds, or about a second in total. All of the tests mentioned have had multiple values of N ranging from 1000 to 20,000.   

This is the performance that was discovered after looping over iterations ranging from 1,000,000 to over 400 million. The performance of Java and JavaScript are fairly compatible, even though Java took about twice as much time as a JavaScript program, however, Python almost always took ten times as long as JavaScript for the double for loop. 

Share:

DBMS – Instances and Schemas

GPS Personal Tracker From Stesalit Systems Ltd.