Is Perl *that* good?

Leif B. Kristensen junkmail at solumslekt.org
Wed Apr 28 03:00:19 EDT 2004


S Koppelman wrote:

[Leif B. Kristensen]
>> In theory, the web routine for phonetic searches might have been
>> implemented in PHP. The trouble with that is that I would have to
>> maintain both a PHP and a Perl version of the same routine. I find it
>> much easier to just copy and paste the whole mess (at present about
>> 120 lines) between the encoding and the decoding routines in Perl,
>> and run an exec("perl norphon.pl $name") from PHP.
> 
> Well, that's not PHP's fault, especially with such straightforward
> regexps. The only reason to user perl over PHP in that case is the
> valid one you cite: you already wrote the damned code in perl. ;)
 
I actually did rewrite the routine once in PHP, but I usually find
regexps in any other language than Perl a PITA.

> Meanwhile, wouldn't it run more efficiently if you hosted your perl
> functions under mod_perl or some other persistent harness like a SOAP
> or XML-RPC daemon and had the PHP call accross to that? 

I don't run my own Web server, so I have limited opportunities for
configuration. Exec() seems to be the only viable alternative for now.

> Execing out  
> and having perl launch, compile and run your script each time is a
> waste of resources, not to mention needlessly slow. You might not
> notice it if you're the only person using it, but if there's a sudden
> uptick in traffic to your site from fellow Scandinavian diaspora
> genaologists, you will.

I had expected some penalty for running a Perl routine from PHP, but in
practice, the process is blazingly fast. You may verify this for
yourself if you visit http://solumslekt.org/slekta/innhold.php and
enter some common Norwegian name like "Berte" in the "Fornavn" (given)
field, and "Olsdatter" in the "Etternavn" (surname, or more likely a
patronym) field. The page is generated and served in a fraction of a
second, as you can see in the blue box at the bottom.

I wonder if Apache is smart enough to keep the compiled Perl code cached
in memory, even if mod_perl is not loaded?

regards,
-- 
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est



More information about the Python-list mailing list