You might look at benchmarking the code to see what portions take the longest time.

You might look at possibly using the NET::SMTP or another module for sending mail, and see if it would be feasible to use that module to send the message directly (or queue them up to your outgoing mailserver), rather than opening an external program to send each message-my guess would be that that is probably the most expensive portion of the program. (You might want to look at performing some form of benchmarking to verify this.)

Also, if the same message is being sent to each recipient, you might consider building in memory a template of the message, make a copy then do a search/replace on the portions that are changing. I don't know if that would save much time-you'd need to look at benchmarking the change to be sure.

I'm still learning when to benchmark code as well, but I think this would be an instance where it would prove quite helpful.

I hope some of the more knowledgable monks will be able to provide more helpful information, and that this helps in some small way. Good luck with the project.


In reply to Re: speeding up a script by atcroft
in thread Speeding up a mailing list script by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.