So I'm writing a program to parse certain information out of html pages.
Currently the program consists (in a simplified manner) of one function called List_Parse() which takes the page to parse.
This page contains a list of links which then need to be retrieved by the get_page_html() method and there content passed to retrieve_info();
Once all the links in the original page passed to List_Parse are exhausted, I increase the pg variable in the query part of the url and again pass this page to List_Parse() and repeat the process.
Currently I have this done using loops and recursion and I can grab and parse about 1 page a second. This would seem to be a decent speed, however parsing 1000 pages takes roughly 15 minutes.
I am looking for a way to process multiple pages concurrently to speed up the process (I am open to other ways of speeding it up as well of course) but I am unsure of how to do this.
I know that multithreading/forking/somehow parallel processing should be able to do this (run multiple instances of subroutines concurrently) but I haven't found a primer I can wrap my head around.
If someone could maybe shoot some pseudo code in my direction or offer any tips on how to do this (I'm currently using Activestate and my program will only be running on windows and MAYBE on Mac)
Thanks
-Bob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.