sezero / uhexen2

Hexen II: Hammer of Thyrion -- A cross-platform port of Hexen II game.
https://sourceforge.net/projects/uhexen2/
76 stars 14 forks source link

quakefs.c: added hashing for the file names #50

Closed BSzili closed 2 years ago

BSzili commented 2 years ago

I added hashing to the FS functions as well to help with the loading times a bit. It's loosely based on Quake 3, but I used a simpler hash function as pak file names are case sensitive.

sezero commented 2 years ago

Can you rebase to current master?

Have you tested against dynamic gamedir changes? (Not in h2, but hw does that. By brief eyeballing it should work I think, but still...)

BTW, Z memory is getting more and mode burden, I hope it doesn't blow up..

BSzili commented 2 years ago

Of course, in fact I might redo this with hashindex to be consistent with the rest of the changes. Fortunately these hash tables are not too large, so far I haven't seen any zone allocations to fail. I'll check with Z_DEBUG_COMMANDS just how much memory is actually used.

BSzili commented 2 years ago

I redone this with hashindex, it's much cleaner without the linked list bolted into pakfiles_t. I listed the zone usage on demo1 and I get below 500 KB. The hash tables take up about 2-8KB each, so not a significant increase, and there are only a few of them.

sezero commented 2 years ago

This is in.