A 10-minute description of how Judy arrays work and why they are so fast
judy.sourceforge.net
judy.sourceforge.net
Yes, this does highlight the problem with such heavily optimised structures - that they are somewhat hardware specific - but it doesn't mean that this is an accurate demonstration of the performance improvement you'd see nowadays.
Also even simple hash table greatly benefits from even trivial cache-related optimization, so I would say that while Judy is extensively optimized for particularly common expectation, simple hash tables have to be optimized for every platform also.
On the other hand, for most use-cases these optimizations does not matter much, but there are special cases. Python's dictionary is great example (by thew way it is if I remember correctly also optimized for 64B cache lines)
Personally, while the 32-byte cache line size is mentioned as an aside in a couple of places, I'd prefer to see it acknowledged in a bit more of an upfront manner. He doesn't exactly go out of his way to say that Judy would be a lot faster on a different machine.
Then they were tuned to work fast from inside main memory (avoid jumps).
Now they are tuned to work within the typical cache of a CPU (keep reads near each other).
Today, divides can be cheaper than branch mispredictions and cosines can be cheaper than cache misses.
Well I cannot describe Judy in 10 minutes -- what possessed me? I hope you understand some of what I have said and question me on the rest -- particularly those doubts. I will try to elaborate on parts where I get questions.
An interesting read, nonetheless. But a warning for those expecting a full description in 10 minutes. :)
In this post.
Additionally, some of Judy's space and speed improvements come from strategies that could be used by any data structure but aren't because they're not good software engineering.
Seemed like an odd statement. That's like saying "Assembly is obtuse and it's bad software engineering to use it." IMHO, it depends. If you are writing low-level code that will run very frequently, perhaps good engineering would suggest that you should optimize in assembler.
I think, there are places in your code where you need good runtime performance and spending programmer time and sacrificing generic dogma are justified.
Like the author says at the end. If some tool/library/service meets my needs (in this case robust and fast being among them), then I'm not too concerned about how it gets there:
Of course, you can certainly take the attitude that Judy performs well enough, and the fact that it's 20,000 lines of code doesn't really matter, as long as those lines of code work and you never have to look at them--and it appears Judy is mature enough that this is the case.
It has singly-linked list, lists, simple queues, tail queues and circular queues.
If you're comfortable with Linux kernel style lists, then sys/queue.h will be familiar, and it's shipping in glibc and on BSD systems (where it was originally from).