ANN: PyJudy 1.0

Andrew Dalke dalke at
Sun Nov 6 20:35:19 CET 2005

Over the last three weeks of on-and-off work I've developed and have
just released PyJudy 1.0, a wrapper to the Judy sparse dynamic array
library.  It is available for download at

Judy, from , is ...

    a C library that provides a state-of-the-art core technology that
    implements a sparse dynamic array. Judy arrays are declared simply
    with a null pointer. A Judy array consumes memory only when it is
    populated, yet can grow to take advantage of all available memory
    if desired.  Judy's key benefits are scalability, high performance,
    and memory efficiency. A Judy array is extensible and can scale up
    to a very large number of elements, bounded only by machine memory.
    Since Judy is designed as an unbounded array, the size of a Judy
    array is not pre-allocated but grows and shrinks dynamically with
    the array population.

Continuing from the PyJudy page at

    PyJudy arrays are similar to Python dictionaries and sets. The
    primary difference is that PyJudy keys are sorted; by unsigned
    value if an integer, byte ordering if a string and object id if
    a Python object. In addition to wrapping the underlying Judy
    functions, PyJudy implements a subset of the Python dictionary
    interface for the JudyL and JudySL API and a subset of the set
    interface for the Judy1 API, along with some extensions for
    iterating a subrange of the sorted keys, values and items.

In my performance tests I found that overall JudyL arrays were a
bit slower than Python dictionaries.  Part of that might be my
inexperience with the details of writing Python extensions.  Part
might be that JudyL arrays are sorted.

I found that the Judy1 arrays were faster than the set class
in Python 2.4.  It'll be interesting to see how Raymond's new
set implementation affects that.

I did not do any memory comparisons.

PyJudy is distributed under the MIT license because that
has few upper-case letters than the BSD one.

					Andrew Dalke
					dalke at

					dalke at

More information about the Python-announce-list mailing list