[Xapian-devel] btree function question ?? ( prev charset error , send again )

kay jean kayjean at gmail.com
Wed Dec 15 07:28:13 GMT 2004


Hi

I just want to study the core of btree function. So I hava a small test program.

I try to add different items 1000000 times.
(test1 , test1)  (test2 , test2) (test3 , test3) .....(test1000000 ,
test1000000)
after that I run the program again and again

step 1 , db file size is 54099968 , get_entry_count is 1000000

step 2 , db file size is 108208128 , get_entry_count is 1000255

step 3 , db file size is 108240896 , get_entry_count is 1000868

file size and get_entry_count grows slowly , Is that ok ??

Thanks 

Hao Kuang , Ku
kayjean at gmail.com

--------------------------test code is ------------------------

#include "btree.h"
using namespace std;

int main()
{
Btree table( "test", false );
if( !table.exists() )
        table.create(8192);
table.open();
int revision = table.get_open_revision_number();
printf( " revision is %d\n " , revision );

printf( "entry count %d \n" , table.get_entry_count() );
string tag;
char temp[1000];
for( int i = 0 ; i < 1000000 ; i++ )
{
        sprintf( temp , "%i" , i );
        tag = "test";
        tag.append( temp );
        table.add(tag, tag);
        if( i % 10000 == 0 )
        {
                printf( "%s\n" , tag.c_str() );
                printf( "%d\n" , i );
        }
}
table.commit( table.get_open_revision_number() + 1 );
return 0;




More information about the Xapian-devel mailing list