Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 26th, 2012, 08:35 AM
metabo metabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 229 metabo Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 2 Days 13 h 54 m 30 sec
Reputation Power: 0
Parallel::ForkManager - machine way tooo slow - need a quad-core machine

tryin to get this to work:

what is aimed: have a list of 300 to 400 urls - i need thumbnails of all of them:

Duuu: do i need a 4 Core processor!?`

tryin to get this to work:

Q: do i need a 4 Core processor!?`

why: well i am guessing that my machine is bit too solow hmmm i added Parallel::ForkManager.

But if you do so - you need a blisteringly fast machine it uses lots of mb of memeory and a bunch of the core running opensuse 12.2 and perl 5.14.2

my machine is too slow - whats if i want to run this with lemme say 200 URLS (or websites) do i need a 4 Core processor!?`




PHP Code:
#!/usr/bin/perl 
 
use WWW::Mechanize::Firefox
use 
strict
use 
warnings
#use Parallel::ForkManager;  

#my $fork = Parallel::ForkManager->new(25); 
 
#sites 
my @urls qw(http://www.google.com http://www.yahoo.com http://www.cnn.com http://www.bing.com http://www.nbcnews.com/... and thosusand 

others more ); 
#temp base dir 
my $temp '/home/aaron/cgi-bin/'
 
for 
my $each (@urls){ 
    
#$fork->start and next; 
    
my $mech WWW::Mechanize::Firefox->new(launch => 'firefox',create => 1,); 
     
    
$each =~ /www\.(\w+)\.com/; 
    
my $name = $1
    print 
"creating $name.png\n"
     
     
    
$mech->get($each); 
    
my $png $mech->content_as_png(undefundef, {width => 240,height => 240}); 
     
    
my $dir_name "$temp/$name".".png"
    
open my $file">""$dir_nameor die "couldnt create $temp/$1.png"
    
binmode $file
    print {
$file$png
     
    
close $file
    
sleep 5# sleep some to give it a little time to make sure things compleated..... you'll need this more using fork 
     
    #$fork->finish; 

print 
"Well All done!\n"
#$fork->wait_all_children; 

Last edited by metabo : October 28th, 2012 at 09:11 AM.

Reply With Quote
  #2  
Old October 27th, 2012, 02:34 AM
metabo metabo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 229 metabo Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 2 Days 13 h 54 m 30 sec
Reputation Power: 0
any idea - well how does the programme behave at your site?

Reply With Quote
  #3  
Old October 27th, 2012, 08:39 AM
FishMonger FishMonger is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2009
Posts: 1,645 FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level)FishMonger User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 21 h 26 m 36 sec
Reputation Power: 1170
I concur with the answers you received on your perlmonks cross post.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Parallel::ForkManager - machine way tooo slow - need a quad-core machine

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap