in reply to Re^2: Do you really want to use an array there?
in thread Do you really want to use an array there?
use strict; use Devel::Size qw(size); my $wektor = ''; for(0 .. 10000000) { vec ($wektor, $_, 32) = $_; } print "Vector's size: " . size( $wektor ) . " bytes\n"; my @vec; my $Aa=time(); for(0 .. 10000000) { push @vec,vec ($wektor, $_, 32); } print "unpack vector in \t",time()-$Aa," secs...(oh Yeah!!!)\n";
In the above code i used 4 bytes for each doc id. I tried with a vector where i save the same number of doc ids but with only 1 byte for each doc id ( i saved only small numbers) and the time was completely the same..I cant understand why..DOes anyone??Size of vector is 40000032 bytes unpack vector in 6 secs...(oh Yeah!!!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Do you really want to use an array there?
by BrowserUk (Patriarch) on Apr 14, 2008 at 15:40 UTC | |
by MimisIVI (Acolyte) on Apr 14, 2008 at 16:57 UTC | |
by BrowserUk (Patriarch) on Apr 14, 2008 at 17:36 UTC | |
by MimisIVI (Acolyte) on Apr 14, 2008 at 17:51 UTC | |
by BrowserUk (Patriarch) on Apr 14, 2008 at 18:25 UTC | |
|