Max Gribov wrote:
On 04/06/2010 01:17 PM, Marty Anstey wrote:
Nick Hilliard wrote:
"PHP stinks on the command line and text processing"
This is a bit of a broad sweeping statement! Can you elaborate on what your definition of how PHP "stinks" in this context?
well, try to parse ~60mb csv file doing some simple tweaks to the input and then insert it into the database, and watch how much ram your script will use, as well as how long it will take vs perl.. for me, it takes about 5 hours and eats up to 1gb of ram (configured memory limit for php for me)
Hi Max, While I appreciate where you're coming from, I've never had that issue. It sounds like you're trying to load the entire script into RAM and then parse it. Regardless of the language you are using, you'll still essentially get the same result.
that said, php is awesome otherwise, been using it for last 2 years strictly in 'enterprise' deployment.. id just say perl is faster and more efficient for batch scripts.
I can't speak specifically to the performance differences for comparible operations in PHP and PERL as I have never done a side-by-side comparison myself. But FWIW, I have parsed multi-gigabyte files with PHP on the command line and it's never been markedly "slow". Sure, it's not pure C but it's never been so slow that i've thought - "heck, this would be a lot faster with PERL"... Just my $0.02... Cheers, -Marty
On 04/06/2010 11:05 AM, Marty Anstey wrote:
that said, php is awesome otherwise, been using it for last 2 years strictly in 'enterprise' deployment.. id just say perl is faster and more efficient for batch scripts.
I can't speak specifically to the performance differences for comparible operations in PHP and PERL as I have never done a side-by-side comparison myself. But FWIW, I have parsed multi-gigabyte files with PHP on the command line and it's never been markedly "slow". Sure, it's not pure C but it's never been so slow that i've thought - "heck, this would be a lot faster with PERL"...
One data point that I can speak to is the difference in parsing XML using the expat library between python and PHP for very large files. Python was quite a bit faster than PHP, but I can't recall the exact magnitude (2x? 10x? it's been too long but it was pretty significant). That said, performance is only one reason to use a language over others. PHP programmers are probably 10x more plentiful than python programmers, as another metric. So it very much depends on the larger picture. Mike, who hasn't found the CLI interface to PHP particularly better or worse than others
Marty Anstey <marty.anstey@sunwave.net> writes:
Max Gribov wrote:
On 04/06/2010 01:17 PM, Marty Anstey wrote:
Nick Hilliard wrote:
"PHP stinks on the command line and text processing"
This is a bit of a broad sweeping statement! Can you elaborate on what your definition of how PHP "stinks" in this context?
well, try to parse ~60mb csv file doing some simple tweaks to the input and then insert it into the database, and watch how much ram your script will use, as well as how long it will take vs perl.. for me, it takes about 5 hours and eats up to 1gb of ram (configured memory limit for php for me)
While I appreciate where you're coming from, I've never had that issue. It sounds like you're trying to load the entire script into RAM and then parse it. Regardless of the language you are using, you'll still essentially get the same result.
As it happens, the loadup script I wrote that parses ARIN bulk whois dump data and loads it into an SQL database is both written in PHP and about an order of magnitude faster than its predecessor which was written by someone else in perl. Helps that I knew enough to LOCK TABLES... :-) -r
participants (3)
-
Marty Anstey
-
Michael Thomas
-
Robert E. Seastrom