Re: Somewhat of a GQuark



Harring Figueiredo wrote:
 Tristan,

  If you take the flat file approach, you could save the hasmap on the file
using some type of key=value pair

  And then loading it back and reinserting into the hashmap...

  Maybe this is the stuff you are trying to avoid doing ?
Yep, I think so ;-)

I have an api something like:
    Index Create("name");
    Index LookupIndex("name");
    int   Get(index, &record);
    int   Set(index, &record);

Where Get and Set are very fast operations, but the lookup
(and subsequently the create) requires that I loop over all my records
while strcmp()ing record->name in order to find the corect index
(i.e. index == (off_t)file offset).

If I could at least turn the strcmp() into a (quark == record.name_quark)
I could gain alot of cycles. But if I had to loop over a list and strcmp
just to find my quark, I'll probably bloat instead.

If I thought that I would get significantly more "lookups" than "creates";
then keeping a local copy of the "quark hash" might be efficient.

I'm not so sure.

Cheers,
                              -Tristan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]