Re: A question of speed
- From: Sherm Pendley <sherm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 15:24:35 -0400
"Robert Hicks" <sigzero@xxxxxxxxx> writes:
I have some co-workers that are writing an email parser (not sure of
the specifics) that is going to process around 5000 emails a day. I
suggested that they go a pure Perl route but they are leary about Perl
being "fast" enough to parse that many emails.
I have no definitive experience with something on this scale but I am
sure someone on the Perl group does.
Smarter folks than me have said it better:
"You can always write faster code in C, but you can always write code
faster in Perl".
"The first rule of optimization is, don't do it. The second rule of
optimization is, don't do it *yet*."
"Premature optimization is the root of all evil."
I forget the origins of those quotes, but they're words to live by. With that
in mind, I would take a "first pass" at the app using pure Perl. If perform-
ance is acceptable at that point, you're done.
Otherwise, profile the app to find the bottlenecks, and try to find better
algorithms to use in those areas before resorting to C - a slow algorithm
written in Perl will be slow in C too.
Finally, if your app is still not performing adequately after all this is
done, I'd look at using XS or Inline to replace any critical sections of
the app with C versions.
Startup speed could be an issue with Perl here. If your app is run 5000 times
a day and handles a single email each time, then that's 5000 times that perl
has to compile the code. You'd be better off with a single long-lived Perl app
that calls its parsing function 5000 times.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
.
- References:
- A question of speed
- From: Robert Hicks
- A question of speed
- Prev by Date: Re: search and replace on an array
- Next by Date: Re: Professional IDE for a cross-platform Perl application
- Previous by thread: Re: A question of speed
- Next by thread: search and replace on an array
- Index(es):
Relevant Pages
|
|