One suggestion on the API side would be to remove all (public) macros and then use the Win32 API approach:

 

Example (using macros from winnt.h):

 

DECLARE_HANDLE(HZIP);

HZIP  OpenZip(const char *fn, const char *password);

DWORD UnzipItem(HZIP hz, int index, const char * fn);

Etc.

 

Externally HZIP is just a named structure so cannot be passed to other different routines (unlike void*) and the correct level of indirection works etc.

Internally you cast it to whatever you want: in this case, it’s just a ptr to a struct.

 

When I first looked at Judy, the most frustrating issues I had were dealing with the preprocessor macros and the lack of type safety in the use of (void*).

 

A secondary issue is the error handling which needs to be a single check on each function return – personally, I am not a fan of returning error codes via arguments and prefer to just have a FALSE or NULL return from the function directly. It should be obvious to me why the error occurred and if not, there’s always the Judy source to look at.

 

Regards,

 

Toni.

 

 

From: judy-devel-bounces@lists.sourceforge.net [mailto:judy-devel-bounces@lists.sourceforge.net] On Behalf Of Doug Baskins
Sent: 14 December 2007 09:37
To: zooko
Cc: judy-devel@lists.sourceforge.net
Subject: Re: Save the array to a file?

 

Zooko:

> Glad to hear it!  Please don't waste your time trying to make Judy 
> multithread-safe.

Ok, I will leave that one on the back burner.

> , my wishlist includes faster performance 
> (in the single-threaded case),

That is my plan.

> simpler code base,

That is my plan.

> easier to use APIs,

I need help on that one.  Please make suggestions.  I am out of ideas.

> and possibly extensions such as a pluggable sort order (even though 
> that would probably be a big performance loss if it were used). 

I believe there only 2 practical ways with the method used with Judy.
1) "Numeric" sort as in numbers
2) "Dictionary" sort as in alphabetic.

> Also 
> improving performance on 32-bit machines would be good.

That's the plan, but there is really little difference from 32 and 64 bit.

> 32-bit 
> machines are not going away -- they're just becoming smaller, 
> cheaper, lower-power, and more ubiquitous.

Thanks for your inputs.

Doug

 

----- Original Message ----
From: zooko <zooko@zooko.com>
To: Doug Baskins <dougbaskins@yahoo.com>
Cc: Jimi Xenidis <jimix@pobox.com>; judy-devel@lists.sourceforge.net
Sent: Monday, December 10, 2007 5:50:34 AM
Subject: Re: Save the array to a file?

On Dec 9, 2007, at 7:09 PM, Doug Baskins wrote:

> Sorry for a delayed response.  I have just settled down in my 
> Thailand home after
> being on the road for about 6 weeks.  I plan on doing some intense 
> work on Judy
> for the first time in about a year and a half.

Glad to hear it!  Please don't waste your time trying to make Judy 
multithread-safe.  Instead, my wishlist includes faster performance 
(in the single-threaded case), simpler code base, easier to use APIs, 
and possibly extensions such as a pluggable sort order (even though 
that would probably be a big performance loss if it were used).  Also 
improving performance on 32-bit machines would be good.  32-bit 
machines are not going away -- they're just becoming smaller, 
cheaper, lower-power, and more ubiquitous.

By the way, you might be interested in the modern work on cache-
friendly data structures e.g.

http://citeseer.ist.psu.edu/569573.html

Regards,

Zooko