perlmonkdr has asked for the wisdom of the Perl Monks concerning the following question:
Hello guys,
I'm working with DBD::CSV module and can't find the problem that eats a lot of memory, check this example:
#!/usr/bin/perl use DBI; our $st = DBI->connect('DBI:CSV:f_dir=.',{RaiseError=> 1}); my $check = $st->prepare(q{ SELECT COUNT(*) FROM list WHERE id=? LIMIT 1 }); my $a = 0; while ($a++ < 1000000) { $check->execute($a.('z' x 10)); print $a.('z' x 10)."\n"; } $check->finish(); $st->disconnect();
To make the list table use this:
#!/usr/bin/perl open F, '>','list'; print F "id\n"; for (0..1000000) { print F $_.('z' x 10)."\n"; } close F;
I hope that your computer is sufficiently slow to take several seconds to process this, if not, increase to 10 million or billon lines, even if you can't see anything, please gift me your pc ;-)...
somebody him to happened something similar?
What's can i do to decrease the use or better the hunger of memory and the cpu too, becouse it's really really slow.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBD::CSV eats memory
by jZed (Prior) on Nov 16, 2007 at 02:17 UTC | |
by perlmonkdr (Beadle) on Nov 16, 2007 at 14:22 UTC | |
by jZed (Prior) on Nov 16, 2007 at 18:02 UTC | |
by perlmonkdr (Beadle) on Nov 19, 2007 at 23:28 UTC | |
Re: DBD::CSV eats memory
by dragonchild (Archbishop) on Nov 16, 2007 at 03:57 UTC | |
by jZed (Prior) on Nov 16, 2007 at 04:08 UTC | |
by dragonchild (Archbishop) on Nov 16, 2007 at 16:41 UTC | |
by jZed (Prior) on Nov 16, 2007 at 22:40 UTC | |
by perlmonkdr (Beadle) on Nov 16, 2007 at 14:27 UTC | |
by perlmonkdr (Beadle) on Nov 16, 2007 at 14:26 UTC |
Back to
Seekers of Perl Wisdom