ArticleslgStudy

science

Judy array

Judy array is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Judy array rather than just read about it. In short: In computer science, a Judy array is an early-2000s Hewlett-Packard hand-optimized implementation of a 256-ary radix tree that uses many situational node types to reduce latency from CPU cache-line fills. As a compressed radix tree, a Judy array can store potentially sparse integer- or string-indexed data with comparatively low memory usage and low read latency, without relying on hashing or tree balancing, and with…

Key takeaways

  • Judy array belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Judy array to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Judy array from memory before moving on to harder problems.

Reference excerpt

In computer science, a Judy array is an early-2000s Hewlett-Packard hand-optimized implementation of a 256-ary radix tree that uses many situational node types to reduce latency from CPU cache-line fills. As a compressed radix tree, a Judy array can store potentially sparse integer- or string-indexed data with comparatively low memory usage and low read latency, without relying on hashing or tree balancing, and without sacrificing in-order traversal. Per-operation latency scales as O ( log ⁡ n ) {\displaystyle O(\log n)} —as expected of a tree—and the leading constant factor is small enough that Judy arrays are suitable even to the peta-element range. When applicable, they can be faster than implementations of AVL trees, B-trees, hash tables, or skip lists from the same time period.

History The Judy array was invented by Douglas Baskins over the years leading up to 2002 and named after his sister.

Node types Broadly, tree nodes in Judy arrays fall into one of three categories, though the implementation uses situational variations within each category:

A linear node is a short, fixed-capacity, array-based association list meant to fit in one cache line. That is, such a node has an array of key bytes and a parallel array of values or pointers. Lookup is by linear search over the key array and then random access to the corresponding index in the value/pointer array. A bitmap node is a size-256 bitvector tracking which values/children are present and then a sorted list of corresponding values or pointers. Lookup is by population count of the bits up to the target index and then random access to the corresponding entry in the value/pointer array. The bitmap fits within a typical CPU cache line, and random access only loads one cache line from the sorted list, so for reading these nodes require at most two cache-line fills. An uncompressed node is a conventional trie node as an array of values/pointers. Lookup is by random access using the key byte as an index, which at the CPU level requires visiting one cache line. Linear nodes are used for low branching, bitmap nodes for intermediate branching, and uncompressed nodes for high branching.

Advantages and disadvantages Due to cache optimizations, Judy arrays are fast, especially for very large datasets. On certain tasks involving data that are sequential or nearly sequential, Judy arrays can even outperform hash tables, since, unlike hash tables, the internal tree structure of Judy arrays maintains the ordering of the keys. On the other hand, Judy arrays are not suitable for all key types, rely heavily on compile-time case-splitting (which increases both the compiled code size and the work involved in retuning for a new architecture), make some concessions to older architectures that may not be relevant to modern machines, and do not exploit SIMD. They are optimized for read performance over write performance.

See also Radix tree Bitwise trie with bitmap Hash array mapped trie

References

External links Main Judy arrays site How Judy arrays work and why they are so fast A complete technical description of Judy arrays An independent performance comparison of Judy to Hash Tables A compact implementation of Judy arrays in 1250 lines of C code

Worked examples

Example 1 — a first encounter with Judy array

Start with the simplest possible case. Write down what Judy array claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Judy array before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Judy array ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Judy array

In research
Judy array appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Judy array in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Judy array is common in secondary-school and first-year university syllabi. It links to neighbouring topics Associative arrays, so understanding it makes those chapters shorter.
In everyday life
Look for Judy array outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Judy array in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Judy array means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Judy array out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Judy array in simple terms?

In computer science, a Judy array is an early-2000s Hewlett-Packard hand-optimized implementation of a 256-ary radix tree that uses many situational node types to reduce latency from CPU cache-line fills. As a compressed radix tree, a Judy array can store potentially sparse integer- or string-index…

Why does Judy array matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Judy array?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Judy array.

Tags

  • Associative arrays

Keep exploring