[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

indexing - Re: [MacPerl] Some suggestions?



on 5/19/99 10:56 AM, Arved Sandstrom wrote...
>A reasonably static list gives you the opportunity to build an index.

Say for instance... I have a huge plain text data file (about 10mb, not 
practical to read into memory) and index all of the words in the file. A 
search on the index file quickly returns all the rows that match the 
given word(s). Now I need to open the actual data file and go directly to 
a given row. Given that I now know what line number(s) I need to go to, 
is there any way to to skip over the rows I do not need and pull out just 
the row(s) I want? Something like...

while (<FILE>) { $count++; if ($count == $row_num) { stuff here... } }

goes fairly quickly, even for 10000 rows, but if I could skip the 
$count++ maybe it would be faster? I guess the same would go for the 
index, the index is sorted and my search key is 'zofo'...

Everthing I have read on this deals with loading the whole thing into 
memory or uses a complicated b-tree approach. Any thoughts?


Thanks,
Scott

>Arved
>
>
>
>===== Want to unsubscribe from this list?
>===== Send mail with body "unsubscribe" to macperl-request@macperl.org
>
>
>On Wed, 19 May 1999, Allan Greenier wrote:
>> The engine will search a list that looks like this:
>> ("Data<TAB>Data<TAB>Data<TAB>Data","Data<TAB>Data<TAB>Data<TAB>Data").
>> This list will be 500 items long. Sometimes it needs to search in the
>> first item, sometimes the others. Usually only one item.

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org