Link Details

Link 100759 thumbnail
User 196387 avatar

By ekabanov
via dow.ngra.de
Published: Aug 04 2008 / 08:10

IP2C is a small library that provides IP to country resolution. It uses the free ip-to-country database. There is a PHP and Java frontends to query the database, but PHP implementation is embarrassingly slower (at least an order of magnitude!). Can we do better or is this a basic limitation of the platform?
  • 13
  • 3
  • 1578
  • 761

Comments

Add your comment
User 287383 avatar

phpimpact replied ago:

0 votes Vote down Vote up Reply

You linked to Computer Language Benchmarks without even knowing the version of PHP they are running.

User 241883 avatar

toomasr replied ago:

0 votes Vote down Vote up Reply

PHP 5.2.2-pl1-gentoo (cli) (built: May 8 2007 09:51:53) says on the Computer Language Benchmarks. I guess PHP 5.2.6-2+b1 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 22 2008 21:03:43) and 5.2.2 are quite close. Am I mistaken?

User 287383 avatar

phpimpact replied ago:

0 votes Vote down Vote up Reply

You are right, I missed that, thanks

User 292525 avatar

scriptone replied ago:

0 votes Vote down Vote up Reply

You’re comparing a JIT’d VM based language versus an interpreted dynamically typed scripting language? And you’re shocked the performance is so off? What's next, C++ vs Javascript? OMG...

Embarrassing case study.

User 296637 avatar

eitland replied ago:

0 votes Vote down Vote up Reply

Seems like the server is down.

User 196387 avatar

Jevgeni Kabanov replied ago:

-1 votes Vote down Vote up Reply

We keep bringing it up, but we are hitting some artificial limits like kmemsize imposed by the hosting :(

User 152955 avatar

Gregg Bolinger replied ago:

0 votes Vote down Vote up Reply

This was a great post. Not because of the results but because of how the results were obtained. Seemed quite unbiased to me, which I like. Thanks.

User 294742 avatar

dmitryx replied ago:

0 votes Vote down Vote up Reply

such a comparison is idiocy by definition

User 196387 avatar

Jevgeni Kabanov replied ago:

-3 votes Vote down Vote up Reply

Such a statement is idiocy by definition.

User 287383 avatar

phpimpact replied ago:

0 votes Vote down Vote up Reply

Jevgeni, no reason to start a flame war in this site. That's not why we are here. We all know that php, just like ruby and python, is slower than java. And to be honest, the only embarrassing thing here was you comment, as opposed to your benchmark.

User 196387 avatar

Jevgeni Kabanov replied ago:

-3 votes Vote down Vote up Reply

It's not my benchmark, I just posted it here. And two orders of magnitude *is* embarrassingly slower. So if someone calls it idiocy I'd like to see some argumentation.

User 287383 avatar

phpimpact replied ago:

0 votes Vote down Vote up Reply

It looks to me that you forgot to enable opcode cache, trust me, it reduce the time it takes to compile the code by up to 90%. PHP is an interpreted language. This means that each time a PHP generated page is requested, the server must read in the various files needed and "compile" them into something the machine can understand (opcode).

Also, there are alternatives to the standard PHP interpreter, so if you consider the standard to be slow, try benchmarking your code with another interpreter.

So, for me to take your results seriously, you need to: 1) Benchmark your code with opcode cache enabled, or 2) Benchmark it with different interpreters.


User 316979 avatar

ivo_danihelka replied ago:

0 votes Vote down Vote up Reply

no need to be rude

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.