Comparing runtimes

Question :

Comparing runtimes,

Answer :

I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the script to output.

1) Is it actually worth taking such things into account?

2) Assuming it is worth taking it into account, how do I do this?

I’m using a Mac so I’ve got access to Linux commands and I’m not afraid to compile/create a command to help me, I just don’t know how to write such a command.

Read More  Find the highest order bit in C [duplicate]


If your idea is to compare the languages, I’d say anything outside them is not relevant for comparison purposes.

Nonetheless you can use the time command to measure everything and can compare it with the timing within a script.

Like this:

$ time script.php  HI!    real    0m3.218s  user    0m0.080s  sys     0m0.064s  

It will give you clock time, user time (php interpreter) and sys time (OS time)

If you are thinking web, then it gets a lot harder because you would be mixing webserver overhead and that is not always easy to compare if, say, you are using WSGI v/s mod_php. Then you’d have to hook probes into the webserving parts of the chain as well

Read More  What is the most useful multi-purpose open-source library for java?

That’s the answer Comparing runtimes, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you