It seems that is very slow to decode the Posting List...
I create a posting list with 30000 doc ids and only 2 word ids for each doc and took 35 secs to decode the posting list..
##### 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
Did i make something wrong??
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.