Experimental Comparison of Set Intersection Algorithms for Inverted Indexing

Vladimír BozaITAT 2013

Introduction

In modern information retrieval, the efficiency of the inverted index is paramount. When processing boolean "AND" queries, the system must compute the intersection of sorted lists of document IDs. While theoretical computer science has produced algorithms with superior asymptotic complexities, their real-world performance often falters due to hardware constraints like CPU cache locality. This study evaluates the practical performance of several set intersection algorithms using a large-scale Wikipedia dataset.

Methodology

The study compares three primary algorithmic approaches for set intersection:

  1. Galloping Search (Baseline): A variant of binary search that "jumps" through the larger list to locate elements from the smaller list. It is the industry standard for lists of disparate sizes.
  2. Fast Set Intersection (Cohen and Porat): A theoretically advanced algorithm utilizing tree structures and bit matrices to track non-empty intersections. Its complexity is output-sensitive rather than input-sensitive.
  3. Empty Interval Algorithm (Proposed): A novel approach that identifies and stores the $k$ largest "empty intervals"—ranges in one set where no elements of the other set exist—allowing the search to skip large segments of data with minimal memory overhead.

Additionally, the research investigates the impact of Document Ordering. By reassigning document IDs using $k$-scan clustering, the study aims to create "clumpy" data distributions that are more amenable to skipping logic.

Experimental Results

The evaluation was conducted on 6.5 million English Wikipedia paragraphs and 14,000 TREC queries.

The Theory-Practice Gap

Despite its theoretical advantages, the Cohen-Porat "Fast Set Intersection" algorithm frequently underperformed compared to the Galloping Search baseline. As shown in Figure 2, most query instances resulted in higher execution times for the complex algorithm. This discrepancy is attributed to poor cache utilization; the algorithm's tree-based memory access patterns lead to frequent cache misses, negating its algorithmic efficiency.

Figure 2: Performance comparison between the theoretically "Fast" set intersection algorithm and the Galloping Search baseline. Points above the diagonal indicate the "Fast" algorithm is slower.

The Impact of Data Layout

The most significant performance gains were achieved not through algorithmic complexity, but through data organization. By clustering similar documents together, the resulting document ID lists became more localized. Figure 6 demonstrates that clustered document ordering consistently outperformed random ordering across nearly all queries.

Figure 6: Comparison of query execution times between clustered and random document orderings. Points below the diagonal indicate that clustering improves performance.

The author's "empty interval" algorithm provided a 14% average improvement over Galloping Search on random document orders. When combined with clustered document ordering, the total average query time improvement reached 35%.

Conclusion

This research highlights that in high-performance computing, hardware-aware design is as critical as algorithmic complexity. While complex structures like the Cohen-Porat tree offer theoretical benefits, the overhead of poor cache locality can be prohibitive. Conversely, simple optimizations like document reordering and focusing on "empty spaces" provide substantial, practical performance gains in real-world search environments.

Summary updated

BibTeX
@inproceedings{boza2013experimental,
  author = {Vladimír Boza},
  title = {{Experimental Comparison of Set Intersection Algorithms for Inverted Indexing}},
  booktitle = {ITAT},
  year = {2013},
}
Figure