<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Judy_array</id>
	<title>Judy array - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Judy_array"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Judy_array&amp;action=history"/>
	<updated>2026-04-21T00:57:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Judy_array&amp;diff=298659&amp;oldid=prev</id>
		<title>imported&gt;Bender the Bot: HTTP to HTTPS for SourceForge</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Judy_array&amp;diff=298659&amp;oldid=prev"/>
		<updated>2025-08-09T21:11:36Z</updated>

		<summary type="html">&lt;p&gt;HTTP to HTTPS for &lt;a href=&quot;/index.php/SourceForge&quot; title=&quot;SourceForge&quot;&gt;SourceForge&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Implementation of an associative array}}&lt;br /&gt;
{{notability|date=April 2022}}&lt;br /&gt;
&lt;br /&gt;
In [[computer science]], a &amp;#039;&amp;#039;&amp;#039;Judy array&amp;#039;&amp;#039;&amp;#039; 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.&amp;lt;ref name=&amp;quot;patent&amp;quot;&amp;gt;[https://patents.google.com/patent/US6735595B2/en Robert Gobeille and Douglas Baskins&amp;#039; patent]&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;shop&amp;quot;&amp;gt;Alan Silverstein, &amp;quot;[https://judy.sourceforge.net/application/shop_interm.pdf Judy IV Shop Manual]&amp;quot;, 2002&amp;lt;/ref&amp;gt; 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.&amp;lt;ref name=&amp;quot;ten&amp;quot;&amp;gt;{{Cite web|url=http://judy.sourceforge.net/doc/10minutes.htm|title=A 10-Minute Description of How Judy Arrays Work and Why They Are So Fast}}&amp;lt;/ref&amp;gt; Per-operation latency scales as &amp;lt;math&amp;gt;O(\log n)&amp;lt;/math&amp;gt;—as expected of a tree—and the leading constant factor is small enough that Judy arrays are suitable even to the peta-element range.&amp;lt;ref&amp;gt;{{Cite web|url=http://packages.debian.org/buster/libjudy-dev|title=Debian -- Details of package libjudy-dev in buster}}&amp;lt;/ref&amp;gt; When applicable, they can be faster than implementations of [[AVL tree]]s, [[B-tree]]s, [[hash table]]s, or [[skip list]]s from the same time period.&amp;lt;ref name=&amp;quot;ten&amp;quot; /&amp;gt;{{Update inline|date=June 2025}}&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
The Judy array was invented by Douglas Baskins over the years leading up to 2002 and named after his sister.&amp;lt;ref name=&amp;quot;judy.sourceforge.net&amp;quot;&amp;gt;{{cite web |url=https://judy.sourceforge.net/|title=Home|website=judy.sourceforge.net}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Node types==&lt;br /&gt;
Broadly, tree nodes in Judy arrays fall into one of three categories, though the implementation uses situational variations within each category:&amp;lt;ref name=&amp;quot;shop&amp;quot; /&amp;gt;&lt;br /&gt;
* A &amp;#039;&amp;#039;&amp;#039;linear&amp;#039;&amp;#039;&amp;#039; 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.&lt;br /&gt;
* A &amp;#039;&amp;#039;&amp;#039;bitmap&amp;#039;&amp;#039;&amp;#039; node is a size-256 [[bit array|bitvector]] tracking which values/children are present and then a sorted list of corresponding values or pointers. Lookup is by [[Hamming_weight#Processor_support|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.&lt;br /&gt;
* An &amp;#039;&amp;#039;&amp;#039;uncompressed&amp;#039;&amp;#039;&amp;#039; 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.&lt;br /&gt;
&lt;br /&gt;
Linear nodes are used for low branching, bitmap nodes for intermediate branching, and uncompressed nodes for high branching.&amp;lt;ref name=&amp;quot;shop&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages==&lt;br /&gt;
Due to [[CPU cache|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.&amp;lt;ref name=&amp;quot;nothings&amp;quot;&amp;gt;{{Cite web|url=http://www.nothings.org/computer/judy/|title=A performance comparison of Judy to hash tables}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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&amp;lt;ref name=&amp;quot;nothings&amp;quot;/&amp;gt;), make some concessions to older architectures that may not be relevant to modern machines, and do not exploit [[SIMD]].&amp;lt;ref name=&amp;quot;shop&amp;quot; /&amp;gt; They are optimized for read performance over write performance.&amp;lt;ref name=&amp;quot;shop&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Radix tree]]&lt;br /&gt;
* [[Bitwise trie with bitmap]]&lt;br /&gt;
* [[Hash array mapped trie]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
*[https://judy.sourceforge.net/ Main Judy arrays site]&lt;br /&gt;
*[https://judy.sourceforge.net/downloads/10minutes.htm How Judy arrays work and why they are so fast]&lt;br /&gt;
*[https://judy.sourceforge.net/application/shop_interm.pdf A complete technical description of Judy arrays]&lt;br /&gt;
*[http://www.nothings.org/computer/judy/ An independent performance comparison of Judy to Hash Tables]&lt;br /&gt;
*[https://github.com/JerrySievert/judyarray A compact implementation of Judy arrays in 1250 lines of C code]&lt;br /&gt;
&lt;br /&gt;
[[Category:Associative arrays]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Bender the Bot</name></author>
	</entry>
</feed>