views:

308

answers:

4

Typical performance of Python scripts are about 5 times faster than PHP. What are the advantages of using faster server side scripting languages? Will the speed ever be felt by website visitors? Can PHP's performance be compensated by faster server processors?

+9  A: 

How about when you get charged for CPU time?

I just saved a ton of money by switching to Python!

Mark Rushakoff
lol for that :-)
David Zaslavsky
+10  A: 
The Wicked Flea
+1  A: 

Increasing the execution speed of web request handlers usually translates to handling more requests/second with the same hardware. This is valuable in a number of cases; maintaining one server is much easier than maintaining two.

BTW, why Python and not Haskell? Haskell is 100x faster than PHP in some benchmarks.

jrockway
Benchmarks are ambiguous; assemble a full web application with database queries, etc, and then benchmark the whole application and average its requests-per-second and *then* compare against PHP and *maybe* it'll be more accurate.
The Wicked Flea
+1 for mentioning Haskell! I love Python, and it's certainly a better choice than PHP if performance is important, but if you really care about performance, you need one of C++ (OK), Haskell (better), or C (best). If you want performance and a highly powerful language with an excellent interactive environment, then Haskell is your best choice.
Daniel Pryden
Which benchmarks? (and along those lines, why not just write everything in C? ;-)
David Zaslavsky
David, I thought we programmers were supposed to avoid giving ourselves eyebleeds? :-D
The Wicked Flea
C++ performance is not as good as straight C? Um, no, not unless you're using bloatware libraries.
Jason S
I have measured this stuff. The database is not as slow as you think it is.
jrockway
Honest benchmarking is hard to do. I have been looking for a nice benchmark of available JVM implementations, can't find anything that's decent and recent.
whatnick
+3  A: 

For typical web apps, the difference in speed won't usually be felt within the request itself (the network latency dwarfs your compute time for a typical script that runs inside an HTTP request).

There are plenty of other things that affect scalability, but the processing needs to handle an average request does factor in. So, a lonely user will not feel the difference. A user who is one of many might feel the difference, as the server infrastructure struggles with load.

Of course, throwing more processor will mitigate the issue, but as jrockway says, maintaining two servers is significantly more than twice as hard as maintaining one.

All of that said, in the vast majority of cases, your bottlenecks will not be processor. You'll be running out of memory, or you'll find that your database interaction is the real bottleneck.

timdev