in reply to Re^3: Byte allign compression in Perl..
in thread Byte allign compression in Perl..
##### PACK THE POSTING LIST... my $str = ''; for my $doc_id( 0 .. 30000 ) { print "Doc id:\t",$doc_id,"\n"; $str .= (pack "I", $doc_id) | $SET_MSB; for my $pos ( 0 .. 2 ) { $str .= (pack "I", $pos) & $UNSET_MSB; } } print "pack time \t",time()-$Aa,"\n"; # UNPACK THE POSTING LIST my $Aaa=time(); my $dat = {}; my $doc_id = undef; for( my $i=0;$i<length $str; $i+=4) { my $int = unpack "I", (substr $str,$i); if ( $int > $MSB ) { $doc_id = unpack "I", ((pack "I", $int) & $UNSET_MSB); } else { push @{$dat->{$doc_id}}, $int; } } print "unpack time \t",time()-$Aaa,"\n";
pack time 2 unpack time 35
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Byte allign compression in Perl..
by tachyon-II (Chaplain) on Apr 11, 2008 at 19:11 UTC | |
|
Re^5: Byte allign compression in Perl..
by tachyon-II (Chaplain) on Apr 12, 2008 at 03:43 UTC | |
by BrowserUk (Patriarch) on Apr 12, 2008 at 04:37 UTC | |
by tachyon-II (Chaplain) on Apr 12, 2008 at 06:23 UTC | |
by BrowserUk (Patriarch) on Apr 13, 2008 at 10:00 UTC | |
by tachyon-II (Chaplain) on Apr 13, 2008 at 10:25 UTC | |
|