> -----Original Message-----
> From: Doug MacEachern [mailto:[EMAIL PROTECTED]]
> 
> On Wed, 26 Sep 2001, Matt Sergeant wrote:
> 
> > Robin Berjon thought I should post this as a heads-up to 
> anyone thinking
> > what I thought: "XS or pure perl code will always be faster 
> than backticks
> > or system() calls".
> > 
> > Wrong.
> 
> matt your benchmark is severly flawed.  for starters, your xs and
> external program do not do the same thing.  your xs has the 
> overhead of
> sv_catpv.

As does backticks, surely? If you can tell me a way to make the code faster,
damn I'll do it as we have a *lot* of emails to process :-)

> and who knows what else.

Nothing else. I detailed this in the thread.

> if you want proof that there
> is overhead using backticks, compare the difference of calling an
> xsub that does _nothing_ vs. a backticked program that does _nothing_.

That's not really what I was trying to say. Add some actual code to your
test, and some printf's (and sv code to the XS) and the differences diminish
fairly rapidly.

I was trying to say don't make the _assumption_ that XS or pure Perl code
will be faster. For example, I think a lot of people should re-evalute their
fears of system calls to sendmail, especially where sendmail is qmail's
implementation :-) [unfortunately this is one area not many people are
willing to test, as they don't want to end up sending real emails, and a
failed address path may be much quicker than a real one]

There's also benefits of automatic cleanup with system calls, whereas XS can
easily leak memory or leave files open (especially if it's not an external
library - there's a lot of crap C coders around, and I include myself in
that list :-). I just think it's something that needs less of a blanket
statement.

Matt.

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

Reply via email to