Papers
Topics
Authors
Recent
Search
2000 character limit reached

Benchmarking and Engineering Data Structures for Spherical Range Queries

Published 8 Jul 2026 in cs.CG | (2607.07367v1)

Abstract: Spherical range queries are a fundamental primitive for working with spatial data. Many spatial data structures have been developed to answer these queries, but choosing the optimal one for a specific application is a difficult task. This is because theoretical worst-case bounds are often overly pessimistic, and existing average-case analyses are rather restricted and hard to compare. We address this problem with two main contributions. First, we present a comprehensive evaluation of state-of-the-art spatial indices across a diverse set of benchmarks. This includes a new benchmark based on graph embeddings alongside multiple real-world datasets from the literature. Our benchmark covers instances scaling up to 10M points and ranging between 2 and 960 dimensions. Second, we introduce the Sorted-Projection Radius KD-tree (SPRK-tree), a high-performance KD-tree variant. The SPRK-tree combines aggressive subtree pruning via radius reduction, sorted projection-based leaf nodes, and careful implementation optimizations. It consistently achieves the fastest query times in almost all benchmarks, and ranks second in the few remaining cases.

Summary

  • The paper introduces the SPRK-tree, which significantly reduces spherical range query times via aggressive radius reduction.
  • It employs SNN-based leaf bucketing and SVD rotation, optimizing spatial partitioning even for high-dimensional data.
  • Extensive benchmarks reveal SPRK-tree’s superior performance against conventional trees and brute-force methods in various datasets.

Authoritative Summary of "Benchmarking and Engineering Data Structures for Spherical Range Queries" (2607.07367)

Motivation and Context

Spherical range queries—retrieving all points within a fixed radius of a query in Euclidean space—are foundational for spatial data processing across computational geometry, ML, simulations, and database systems. Existing spatial indices (KD-tree, R-tree, Balltree, VP-tree, SNN, Orthtree, Uniform Grid) vary drastically in theoretical complexity, practical performance, and scalability with respect to dimensionality and distribution. However, worst-case analyses are largely pessimistic and not predictive for empirical workloads, especially those involving graph embeddings, clustering, or high-dimensional real-world datasets. This work systematically addresses these gaps by: (1) providing a comprehensive empirical benchmarking suite covering multiple distributional regimes and diverse datasets; and (2) introducing the Sorted-Projection Radius KD-tree (SPRK-tree), a KD-tree variant leveraging radius reduction, SNN-based leaf buckets, SVD rotation, and hardware-level performance optimizations.

SPRK-tree Design and Algorithmic Innovations

SPRK-tree structurally reframes the KD-tree paradigm via three key mechanisms:

  • Aggressive Radius Reduction: Rather than conservative subtree pruning, radius reduction incrementally refines the query radius using dimension-aware distance vectors while traversing. This technique, grounded in O(d)O(d) operations, excludes regions guaranteed not to intersect the query ball—reducing unnecessary distance evaluations.
  • SNN Buckets in Leaves: Leaf nodes are not exhaustively scanned; instead, SNN projections (sorted by principal axis via SVD) enable binary search plus range scans, reducing the candidate set dimensions significantly. Further, the intersection with the query ball is analytically minimized (rSNNr_{\text{SNN}}).
  • SVD-based Rotation: Prior to tree construction, high-dimensional data is rotated to align axes with principal variance directions. In dimensions d>16d>16, this dramatically improves the early tree partitioning and subsequent pruning—ensuring logarithmic depth and high effective separation.

The core query algorithms are fully detailed in the appendices, where precise updates to distance vectors and SNN-specific candidate evaluation are formalized. Figure 1

Figure 1

Figure 1: Illustration of a 2-dimensional KD-tree and the nodes visited by a query qq, highlighting axis-aligned partitioning and region pruning.

Figure 2

Figure 2

Figure 2: Illustration of the search space pruning in the SPRK-tree, showing finer exclusion of regions through radius reduction and SNN projection.

Hardware-Level Performance Engineering

SPRK-tree implementation exploits vectorized arithmetic, cache-aware layout, and low-level optimizations for SIMD-enabled CPUs. By vectorizing over W=8W=8 points, distance computations are accelerated via fused multiply-adds and multi-accumulator strategies, outperforming naive SIMD-by-dimension approaches in differing regimes. For high dimensions, dot-product reformulation (with precomputed norms) and use of multiple accumulator registers further decrease instruction count and pipeline latency. These effects are empirically validated across datasets of varying size and dimensionality. Figure 3

Figure 3: Illustration of the squared distance computation for W=8W=8 points in d=3d=3 dimensions, requiring only $2d$ SIMD instructions.

Empirical Benchmarking: Strong Numerical Results

A suite of extensive benchmarks—covering graph embedding workloads, uniform and real-world high-dimensional distributions, clustering, and geographic POI searches—demonstrates that SPRK-tree achieves empirically superior query times in nearly all tested configurations.

  • Graph Embedding Benchmarks: For datasets up to n=106n=10^6 and d=32d=32, SPRK-tree consistently outperforms prominent KD-tree libraries (Kiddo, Neighbourhood, CGAL, nanoflann) by factors up to an order of magnitude, maintaining the fastest or second-fastest times even as brute-force becomes competitive at high rSNNr_{\text{SNN}}0.
  • Uniform and Real-world Datasets: For uniform, random, or high-dimensional real datasets (SIFT1M, GIST, Deep1B, F-MNIST, GloVe100), SPRK-tree remains competitive or fastest, outperforming SNN and brute-force in the high-rSNNr_{\text{SNN}}1 regime.
  • Clustering and POI: On DBSCAN clustering workloads and POI queries with heterogeneous spatial densities, SPRK-tree demonstrates best-in-class efficiency, particularly in low dimensions where radius reduction and leaf pruning dominate.
  • Breakdown of Performance Gains: Ablation studies quantify the reduction in distance checks (down to rSNNr_{\text{SNN}}2 of typical KD-tree), and microbenchmarks detail the impact of SIMD-level and multi-accumulator optimizations. Figure 4

    Figure 4: Average time per query for the graph embedding benchmark, across varying vertices and embedding dimensions; SPRK-tree is consistently fastest.

    Figure 5

    Figure 5: Query time for uniformly distributed points in a unit hypercube. SPRK-tree maintains lower times even as dimension increases.

    Figure 6

    Figure 6: Effect of radius reduction and SNN buckets for a rSNNr_{\text{SNN}}3k point dataset, showing substantial reduction in total distance checks relative to brute-force and KD-tree.

    Figure 7

    Figure 7: Effect of fused multiply-add operations and different numbers of accumulation registers. Lower runtime and better scaling with increasing dimension.

    Figure 8

    Figure 8: SPRK-tree query time with and without optimizations, highlighting significant speedup due to low-level engineering especially for small datasets.

Implications and Future Directions

Practically, SPRK-tree enables substantial speedups for algorithms relying on all-pairs or localized proximity queries, notably force-directed graph embedding, DBSCAN clustering, POI retrieval, and high-dimensional database indices. Its combination of algorithmic and hardware-layer engineering positions it as a general-purpose spatial index, robust to high-rSNNr_{\text{SNN}}4 "curse of dimensionality" and distributional heterogeneity. Critically, SPRK-tree avoids the typical pitfalls of spatial indices in high rSNNr_{\text{SNN}}5 by leveraging SVD-based axis alignment and leaf-level SNN sort-projection. The empirical results sharply contradict the assumption—implied by worst-case analyses—that tree-based methods are suboptimal in these regimes.

Theoretically, these results motivate deeper investigation into average-case (rather than worst-case) geometric partitioning and adaptive spatial index selection. Approximate query strategies (e.g., locality-sensitive hashing, randomized projections) remain only marginally promising, as the drop in embedding quality is not compensated by speed. Future work should further integrate learned indices, hybrid tree/grid paradigms, and distributed variants—particularly for ultra-large-scale problems.

Conclusion

SPRK-tree provides a high-performance, empirically validated solution to spherical range queries—demonstrating best-in-class efficiency across diverse datasets and dimensions. The integration of radius reduction, SNN projection, SVD rotation, and hardware optimizations collectively drive its competitive advantage over both traditional and contemporary spatial indices. This work sets a new empirical standard for spatial index benchmarking, and SPRK-tree is poised for adoption in high-performance ML, graph, and spatial inference systems.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.