Re: Slow Script

2009-02-05 Thread Dave Sherohman
On Wed, Feb 04, 2009 at 08:30:23PM -0600, Ron Johnson wrote: > On 02/04/2009 08:04 PM, Alex Samad wrote: > >well he is only comparing int by the looks of (we are just guessing > >until we get more info) so 4 long int records ... > > Record overhead? (Python has it. Don't know about Perl.) Oh, y

RE: Slow Script

2009-02-05 Thread Gorka
> -Mensaje original- > De: Ron Johnson [mailto:ron.l.john...@cox.net] > Enviado el: jueves, 05 de febrero de 2009 3:30 > Para: debian-user@lists.debian.org > Asunto: Re: Slow Script > > On 02/04/2009 08:04 PM, Alex Samad wrote: > > On Wed, Feb 04, 2009 at 08

Re: Slow Script

2009-02-04 Thread Ron Johnson
On 02/04/2009 08:04 PM, Alex Samad wrote: On Wed, Feb 04, 2009 at 08:45:35PM -0500, Chris Jones wrote: On Wed, Feb 04, 2009 at 01:57:04AM EST, Alex Samad wrote: [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 th

Re: Slow Script

2009-02-04 Thread Alex Samad
On Wed, Feb 04, 2009 at 08:45:35PM -0500, Chris Jones wrote: > On Wed, Feb 04, 2009 at 01:57:04AM EST, Alex Samad wrote: > > > [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

Re: Slow Script

2009-02-04 Thread Chris Jones
On Wed, Feb 04, 2009 at 01:57:04AM EST, Alex Samad wrote: > [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. Hmm.. 32 bytes records..

Re: Slow Script

2009-02-04 Thread Chris Jones
On Wed, Feb 04, 2009 at 06:17:43AM EST, Dave Sherohman wrote: > On Tue, Feb 03, 2009 at 09:02:52PM -0500, Chris Jones wrote: > > 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

Re: Slow Script

2009-02-04 Thread Steve Lamb
Dave Sherohman wrote: > Given that the posted loop is operating entirely on Perl in-memory > arrays, the OP is unlikely to be deliberately[1] accessing the disk > during this process. TBH given the fragment he posted there's no way to help him. There isn't enough there to make any meaningful

Re: Slow Script

2009-02-04 Thread Dave Sherohman
On Tue, Feb 03, 2009 at 09:02:52PM -0500, Chris Jones wrote: > 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.

Re: Slow Script

2009-02-03 Thread Alex Samad
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; > > } > >

Re: Slow Script

2009-02-03 Thread Chris Jones
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'v

Re: Slow Script

2009-02-03 Thread Joel Roth
On Tue, Feb 03, 2009 at 06:14:48PM +0100, Gorka wrote: > Hi! I've got a perl script with this for: > > for (my $j=0;$j<=$#fichero1;$j++) > { > if (@fichero1[$j] eq $valor1) > if ($fichero1[$j] eq $valor1) ^^^ This is a beginner's mistake. You should use warnings, i.e.

RE: Slow Script

2009-02-03 Thread Stackpole, Chris
> From: Dave Sherohman [mailto:d...@sherohman.org] > Sent: Tuesday, February 03, 2009 11:25 AM > Subject: Re: Slow Script > > On Tue, Feb 03, 2009 at 06:14:48PM +0100, Gorka wrote: > > Hi! I've got a perl script with this for: > > > > for (my $j=0;$

Re: Slow Script

2009-02-03 Thread Boyd Stephen Smith Jr.
On Tuesday 03 February 2009 11:24:37 Dave Sherohman wrote: > Given the small piece of code that you posted and the magnitude of the > numbers you've stated, I strongly suspect that you probably want to use > a database for this, Or, at the very least, a HashTable, Trie, or SearchTree. -- Boyd Ste

Re: Slow Script

2009-02-03 Thread Dave Sherohman
On Tue, Feb 03, 2009 at 06:14:48PM +0100, 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

Re: Slow Script

2009-02-03 Thread Eugene V. Lyubimkin
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; > } > } > Try foreach (@fichero1) { if ($_ eq $valor1) { $token = 1; break; } } -- Eugene V. Lyubimkin aka