Re: A question of speed



"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
.



Relevant Pages

  • Annoying Problem with a Basic Perl app and XP Pro
    ... New to perl, ... I wanted a simple and efficeint app ... sub main_transfer { ... I've looked through the lists, but this issue hasn't shown up... ...
    (comp.lang.perl.misc)
  • Re: Reading Output from Shell Command
    ... I don't know anything about Perl. ... string comes from the output, say about in 1/2 hour, then you might have to ... > my main app, let me tell you a bit about what the app does, and see if you ... > think switching to a redirect and streamreader is the way to go. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Unwanted Paste behavior
    ... But the app ... Usually if I leave Bat/CMD I go to Perl since it is so much easier than ... or at the command prompt. ... What's odd is that Echo. ...
    (microsoft.public.windows.server.general)
  • Re: Unwanted Paste behavior
    ... It was staring ... But the app ... Usually if I leave Bat/CMD I go to Perl since it is so much easier than ... or at the command prompt. ...
    (microsoft.public.windows.server.general)
  • RE: Pass a value to Perl script
    ... Perl wrote: ... > variable in that app which is holding a value let say ... > Now in my perl script I want to parse the string and just want to ... > back (filename) value of $base to that APP using STDOUT. ...
    (perl.beginners)