CategoriesBlog Administration |
Sunday, March 30. 2008Benchmark: PHP vs. Python vs. Perl vs. RubyComments
Display comments as
(Linear | Threaded)
Не могу поверить что ПХП настолько сильно отстает от того же перла.
using the php executable directly? you can use php with a lightweight webserver and reduce 500% the memory needed...
Thanks for your comment. However, my tests were with the CLI version of PHP and not with the Apache2 module, or any other web server. Thus, choice of web server would not have been a factor in my results.
There is a reason why PHP co-developer Zend developed a cache for PHP, being followed by others, like eAccelerator, MMcache. Many hosters also offer these cache already installed in the webserver.
Alas, it would make (more) sense to benchmark the languages based on any of these tools.
Thank you for your comment.
These benchmarks were all performed with the CLI versions of the language interpreters. Web servers and bytecode caches weren't part of the equation.
This benchmark is useless. You can't do any comparison of a stupid hello world app!
You're basically measuring the loading of different interpreters, if anything with such a short script. You'll need bigger test scripts than these if you plan to do any real benchmarks, this is not it.
ed,
Thank you for the comment. Please re-read the second paragraph of this entry. Tim
LOL
U guys needed more than 30 lines for a hello world in PHP?
This is a nice comparison which should be considered before selecting any web technology in web projects..
and thanks for investing your valuable time for this creative stff..
I found the bar graph a great tool to explain to my client the trade-offs of choosing various technologies to build their initial web infrastructure. My client could care less if it's a framework or a language - they want to know what they'll be stuck with when our team is gone. Yes there's opinions and caveats in the details but from a high level perspective it's great stuff.
Hi,
I was just looking for such benchmark to my thesis. I've downloaded your benchmark and run it myself and I have to disagree with your results. First of all when I looked at inc-oo.perl it's identical to inc-p.perl. Maybe it's just a mistake in download version, because oo version was also included in Inc.pm. Anyway to get my results I've changed it to: #!/usr/bin/perl -w use Inc; use strict; my $inc; $inc = Inc->new(); $inc->do_it(); Another problem was with PHP. PHP by default loads many extensions and that's why it uses a lot of memory and it's run time was so long. When you turn them off results are severely different. As I recall other languages doesn't load by default extensions such MySQL support so chances should be equal. My results in incremental test were: PHP: oo 0.9726 f 1.1368 p 0.3347 Perl: oo 1.6991 f 0.9703 p 0.4741 So in my opinion PHP looks quite promising. Especially when you take a look at PHP-CLI version. I suggest you revise this benchmark or maybe I'm completely wrong. Looking forward for your opinion.
Thanks for the comment. I'm glad you found my benchmark useful.
You're correct. inc-oo.pl and inc-p.pl were the same in the archive. Thanks for pointing that out. PHP does load a lot of extensions. However, I wanted to test with a typical configuration, so I used the configuration that comes out of the box. The key was that the configurations of the other languages were just as typical. The variance between the numbers (per language) that you posted seem to be about what I'd expect. The main point of the benchmark is not to compare PHP to Perl per se. The point is to show how different programming styles affect the length of source code, and execution speed in each of the respective languages. Comparing the languages to each other simply gives a brief look at the differences between each language for each programming style.
In my work I needed strict performance comparison so my priorities were different
Anyway this extensions problem didn't give me a rest so I tried testing different configurations. In the end I've found something quite comforting. It's not the default extensions that caused this lose of performance. but xDebug. It's used only in production time and is never installed on final servers - it's only for debugging and lower efficiency in this case is very understandable. My results on my hardware: PHP oo: 0,9741; func: 1,1092; neither: 0,3359 PHP + default extensions: oo: 1,0146; func: 1,1553; neither: 0,3695 PHP + default extensions and xDebug oo: 5,6429; func: 5,8177; neither 0,7888 Try turning this extensions off
To all of you who are looking at these benchmarks as a way to pick the language for your web framework: beware that this is testing the *command line* execution time for these languages. Of the four of these, PHP was designed specifically to serve web pages, and its CLI support is rather pitiful and (obviously per the graphs) quite inefficient.
This means that you're comparing apples to beer if you expect CLI benchmarks to tell you how well a language will perform when serving up web pages (especially when you take things like optcode caching into consideration).
PHP, Ruby, Perl, Python - can anyone tell me a difference?
All are interpreted languages, All have extension, All have everything web developer need, All good for web development. Measuring HelloWorl wouldn't give you any answer. "Default configurations" for every language differs by every distro. I DOESN'T matter what language to use but DOES MATER how you're using it. Plain C can be times slower than PHP, Java or .NET just because of dumb memory allocation logic made by dumb deve... sorry coder... So. Treat these languages as fruits or vegetables. You can make any kind of salad from them an it will taste perfect. More fruits you've tasted - more experience in fruits you have and you'll be able to compile exotic fruit salads on any "party" (project). Just use your brain. All the time. And don't stop asking questions and seek answers!
You're right on the money that it's poorly-wielded OO code that causes the misery. There are so few situations that call for object orientation in the first place (if you know how to write procedurally or functionally) that the inevitability of misuse looms as large as all the Java hype.
"It's like C++, but without pointers!" Sigh. Fun benchmark. I have no idea why people get so upset about comparing apples to beer. One gets the benefits of consuming both. |
Calendar
LinksContact Me
Quicksearch |
Comparativa del rendimiento de cada lenguaje cuando es utilizado en distintos paradigmas: POO, estructurada y en bruto. Proporciona las fuentes para poder comprobarlo en nuestro equipo.
Tracked: May 07, 22:21
This post was mentioned on Twitter by pradeepkrsharma: @kinshuksunil it's #Perl not PERL... but sir it's a very old technology and much stronger than PHP.. check this out http://bit.ly/458Phx ...
Tracked: Nov 12, 16:03