[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Slow Script



On Tue, Feb 03, 2009 at 09:02:52PM -0500, Chris Jones wrote:
> On Tue, Feb 03, 2009 at 12:14:48PM EST, Gorka wrote:
> > Hi! I've got a perl script with this for:
> > 
> >   for (my $j=0;$j<=$#fichero1;$j++)
> >   {
> >     if (@fichero1[$j] eq $valor1)
> >     {
> >       $token = 1;
> >     }
> >   }
> 
> > The problem is that fichero1 has 32 millions of records and moreover
> > I've got to repeat this for several millions times, so this way it
> > would take years to finish.  Does anybody know a way to optimize this
> > script? Is there any other linux programing language I could make this
> > more quickly whith?

[snip]

> More seriouly, when you are dealing with 32 million records, one major
> venue for optimization is to keep disk access to a minimum. Disk access
> IIRC is measured in milliseconds, RAM access in nanoseconds and above..
> 
> Do the math.. 
[silly time]
32 * 4 = 128 

so with 128M of memory he could hold 32 Million long int - I realise the
record is probably got more than int's so with 1G of spare ram he could
have 32 bytes per record.  

[/silly time]

 

[snip]

> 
> HTH
> 
> CJ
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 

-- 
"It's a school full of so-called at-risk children. It's how we, unfortunately, label certain children. It means basically they can't learn.  It's one of the best schools in Houston."

	- George W. Bush
While speaking about KIPP Academy in Houston, TX

Attachment: signature.asc
Description: Digital signature


Reply to: