Re: [AD] Allegro 5 new config routines, alpha 1 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On February 6, 2002 02:59 pm, you wrote:
> > I've coded a first version of the new config routines for Allegro 5,
> > following Shawn's original suggestions on the topic.
>
> What about using . (dot) as the sub-key delimiter instead of / (slash) ?
> Gosh ! I'm being Mozilla-ized ;-)
>
> > I've used a simple hash code based system to retrieve proper entries
> > from the tables; each "directory" has a dedicated table (default size =
> > 4096 entries).
>
> Given that sizeof(struct CONFIG_ENTRY) == 32, each table weights 128kb !
> Assuming the hash function works well, I think a good compromise between
> memory footprint and look-up efficiency could be 128 entries, which gives 4
> kb per table.
>
> > If two names collide onto the same entry, a linked list of names is used
> > onto the same entry, and the proper real entry is searched using normal
> > strcmp(). Look in the code!
>
> Is it Unicode-safe ? Even if we switch to UTF-8 internally, there are
> specific things to be taken care of.
I don't see why the parts of the name have to be parsed out.
With an efficient enough hashing algo, you can just look up
each item by it's full 'path'. This way takes up lots less memory,
and allegro doesn't really require the multilevel hashing scheme
as it won't have thousands upon thousands of entries.
--
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx
http://strangesoft.net