[Top][All Lists]

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

Re: [Gnu-arch-users] Dirname caching for leroy's tla on cygwin

From: John Meinel
Subject: Re: [Gnu-arch-users] Dirname caching for leroy's tla on cygwin
Date: Mon, 05 Jul 2004 13:57:39 -0500
User-agent: Mozilla Thunderbird 0.7 (Windows/20040616)

Hash: SHA1

Well, with the information from Aaron that tla already has done the work
of creating a string->string map, I went ahead and implemented the path
caching. From what I can tell, the assoc_table is a hash map, so it
should be pretty fast. I wonder if a red/black tree would actually be
faster, but that would come to implementing it and profiling.

The reason I wonder is that hash always has to traverse the entire
string, while a comparison would only have to traverse until a mismatch.
If the strings tend to be very different, then it should be faster.
It also depends on how the hash handles collisions, and if we have a lot
of them.

This will probably be more than fast enough, though.

Actually, the only thing that makes this difficult is the _ex functions,
because they want abspath as well. I hope I did it in a reasonable way.

This could still be optimized since there is a lot of redundancy between
the 4 associative containers. (You could have one bulk storage with 4
ways of accessing items inside). But again, I think it will do the job,
and probably do it well.

I went ahead and tagged my repository from rdp, and added the pathcache
functionality into it. It should be accessible from{archives}/address@hidden/

For Lode:
~  I can just send you the two files for caching, plus a patch for
~  pathcompress.c. There isn't a lot that has changed, but I don't have
~  the latest version of your code with TLA_LOG support, or dos names
~  instead of =dirnames.


address@hidden wrote:

|>Also, are you smart about the name, such that if I have the directory
|>and one
|>One of these will get
|>And the other
|>Depending on which was created first, etc.
| Yes, I'm pretty smart about those name :-), I leave it up to
| Microsoft to determine them...!
| Now, all of this has simplified the code a lot!
| What's left to do is caching.
| It is *very* easy to implement, but I do not realy have the time
| just now.
| There is 2 functions to add caching to:
| /* NO CACHING */
| char* pathcompress_uncompress_path(char* path, char* uncompressed) {
|   return pathcompress_process_path(path, NULL, uncompressed);
| }
| char* pathcompress_uncompress_path(char* path, char* uncompressed) {
|   char* tmp = pathcompress_lookup_uncompressed(path);
|   if (tmp != NULL) {
|     strcpy(uncompressed, tmp);
|     return uncompressed;
|   }
|   tmp = pathcompress_process_path(path, NULL, uncompressed);
|   pathcompress_add_uncompressed(path, tmp);
|   return tmp;
| }
| and implement lookup and add as efficiently as possible.
| -- lode
- ----------------------------------------------------------------------------------
| Plaats je zoekertjes GRATIS op AdValvas
| Placez votre petite annonce GRATUITEMENT sur AdValvas
Version: GnuPG v1.2.4 (Cygwin)
Comment: Using GnuPG with Thunderbird -


reply via email to

[Prev in Thread] Current Thread [Next in Thread]