sorry, but i think there is no need for special prefix search functions in the judy arrays.
Look at my example previously posted:
for(pval = JudySLFirst(Jnew, curl, NULL); pval; pval = JudySLNext(Jnew, curl, NULL)) {
  if(memcmp(curl, prefix, prefixlen)) break;
Several people have proposed improvemens to the judy arrays, but nothing had happened until today.
The discussions about cache lines are outdated with today CPUs.

For me the 2 major improvements to judy arrays are:
1  - Using Judy arrays for non null terminated strings (this is currently a big drawback).
2  - Improving performance of the JudySLNext, JudySLPrev by using a cursor structure as parameter.
      The path of the Judy-three and the current string must be stored in this structure.

Von: Tim Margheim <>
An: Doug Baskins <>
CC: judy <>
Gesendet: 20:24 Dienstag, 20.November 2012
Betreff: Re: Prefix-only search?

On 11/20/2012 1:13 PM, Tim Margheim wrote:
From my basic knowledge of the structure, it seems that a prefix-search is simply a First where you quit early if it turns out you would have to go up a level.  So that might be a simple matter of leaving out some code that the normal JudySLFirst() requires.

I have a follow-up question about this.  I just peeked at the source for JudySLFirst(), and it turns out that it works by calling JudySLGet(), then calling JudySLNext() if it failed.  Doesn't that involve a slight duplication of work?  Doesn't it traverse to Index's branch once during JudySLGet() to discover that there is no corresponding value, and then a second time at the beginning of the JudySLNext()?

Could you get a slight improvement by making a private version of JudySLGet() that returns the location of Index's branch for subsequent use in seeding the call to JudySLNext()? Or does all this happen in the cache quickly enough not to make a difference?


Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
Judy-devel mailing list