Assignment Statements, Comparisons & Observations
Font: Size: + -

PHP vs Python vs JavaScript

Friday, April 03, 2020
I was writing code to solve a particular problem on in PHP 7.4 and found that it was taking a lot of time to execute. 10 seconds. Then ported the same code in Python3 thinking it'll be much faster. Nope. 20 seconds. Then I tried JavaScript running not in the browser but in node. Quarter of a second !

Same code in three different languages - three nested loops.

$ time php contiguous-subarray.php

real    0m10.180s
user    0m10.152s
sys 0m0.018s

$ time python3

real    0m20.704s
user    0m20.676s
sys 0m0.017s

time node contiguous-subarray.js 

real    0m0.225s
user    0m0.213s
sys 0m0.010s

JavaScript wins.


Packers and Movers Bhubaneswar said...

Get Packers and Movers Bhubaneswar List of Top Reliable, 100% Affordable, Verified and Secured Service Provider. Get Free ###Packers and Movers Bhubaneswar Price Quotation instantly and Save Cost and Time. ✔✔✔Packers and Movers Bhubaneswar Reviews and Compare Charges for household Shifting, Home/Office Relocation, ***Car Transportation, Pet Relocation, Bike SHifting @ Packers And Movers Bhubaneswar

Packers And Movers Bangalore said...

Packers and Movers Bangalore - Reliable and Verified Household Shifting Service Providers Give Reasonable ###Packers and Movers Charges. Cheap and Best Office Relocation Compare Quotation for Assurance for Local and Domestic House Shifting and Get estimates today to save upto 20%, ***Read Customer Reviews - @ Packers And Movers Bangalore
Packers And Movers Bangalore Service

Packers And Movers Bangalore said...

Packers and Movers Bangalore as a Services providing company can make all the difference to your ###Home Relocation experience. Bangalore based Company which offers versatile solutions, Right team that easily reduce the stress associated with a ✔✔✔Household Shifting, ***Vehicle Transportation. we help things run smoothly and reduce breakages and offer you seamless, Affordable, Reliable Shifting Services, Compare Shifting Charges. @ Packers And Movers Bangalore