Re: R: [AD] Allegro 5 new config routines, alpha 1 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2002-02-07, Angelo Mottola <a.mottola@xxxxxxxxxx> wrote:
>
> The reason why the names are broken up is simple: it makes the load/save
> of subtrees easy to manage. This way you can easily load all the config
> vars of a file into a new config "subdirectory"... Same goes for the
> saving issue. Having all entries stored into an unique table could make
> such features much harder to implement, even if it's not an impossible
> task.
Isn't it just a case of walking through the entire table and comparing
the first n characters? It's not too fast, but I think breaking up
the string and hashing each component each time you make an access is
probably worse. Loading/saving is probably I/O bound anyway.
> In addiction, having an unique table could result in more collisions,
> also between entries belonging to different directories... Which is Not
> Good.
As long as each bucket isn't too deep (i.e. the hashing function is
good, and we don't have thousands of entries), I don't really think
collisions will be much of a problem. `strcmp' is pretty damn fast.
All IMHO of course.