Re: paring large files - PHP or Perl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Cage wrote:
> I'm a great believer in using the right program for the right job. I
> need some advice from people who use both PHP and Perl.  I've long been
> a fan of PHP and we use it for all our development work. However, I seem
> to keep coming up with a bit of a problem when using PHP and I just
> wanted to see if I was right or if there's something I'm not doing right.
>
> Basically, we are bringing emails in from a client that all contain
> large files - usually between 12mb and 15mb in size.  This side of what
> we are doing cannot be changed unfortunately.  When we use PHP to parse
> these files it often times out - I understand that we can flush data and
> we call set_time_limit() occassionally to reset the time counter, but
> PHP really seems to struggle. It just seems that every job I work on
> that needs to parse large files or do something like web crawling that
> we always come across these problems.  A couple of people have said that
> we should look at Perl because it is better at this kind of thing and
> thats why I'd be interested in opinions about it from people who know -
> ie those who regularly code in both
>
> Appreciate any comments or suggestions or even if you can point me to
> any sites that cover this as I looked and couldn't find any

If you already *KNOW* Perl and want to use it, its string manipulation
package is probably better from a sheer performance stand-point.

But I scrape and parse all the time, and just use set_time_limit(0) on
shell scripts that I expect to run a long time, and use a different
php.ini for them if I need a ton of RAM.

I would still code them to not read in all 15M attachments at once,
personally.

Actually, if I was messing with emails, I'd suggest using IMAP to read the
emails, and then you can get only the parts of the email you need, and
pretty much ignore the attachments -- assuming you don't need to parse the
attachment itself...

I'd not suggest that you run off and start learning Perl, though, just to
handle these tasks.  It would take you years to become proficient enough
in Perl to have a better application by reaping the benefits of Perl's
better performance.

And your PHP code is almost for sure always going to be more maintainable
than the Perl version.  Perl code almost always ends up being so...
squeegley, if you know what I mean.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux