You can speed up your task by : optimizing parsing, optimizing url fetching and finally, by fetching several urls in parallel.
If you are looking at your code, you realize most time is spent in blocking get (more precisiously, in slow system call read) So first (and I think last :) ) point to optimize your script - make url fetching in parallel

So let's observe several ways to do this and point advantages and disadvantages :

- using some fork solution. You fork process and download each URL in own process. Excellent example was shown before : Parallel::ForkManager
Advantages : straigt-forward lazy solution. Will work fine for you now
Disadvantages : it will take additional system resources. And you will have to realize some IPC between processes (not so trivial task !) if (when) you wonna to combine results together

threads : Way how this task usually do in C. We make sepearate threads for every URL. So each LWP get will be done in own thread simult with others
Advantages : Easy to implement IPC. Standart solution
Disadvantages : iThreads require many system resources and not very fast :(

- using non-blocking sockets : instead of block if no data ready in socket, read will return immidiately return EINPROGRESS error. So you can make some evnet loop thru set of open sockets : Can we read from this socket ? Read and parse : Try next socket. Check Parallel User Agent
Advantages : Fast. Save resources.
Disadvantages : A bit complicated in programming

In reply to Re: Speeding up HTML parsing by asdfgroup
in thread Speeding up HTML parsing by sulfericacid

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.