cs.DSJul 29, 2026

Memoization Without Keys: Compact, Out-of-Core Tables for Functions of Sorted Arguments

Authors: Tamal Maharaj

Abstract

Memoizing an expensive function of a sorted score vector is a data-structure problem before it is a numerical one: at a billion gridpoints, a hash map or a search tree spends most of its space on keys the grid already determines. We describe an implemented memo table that stores none. An entry's address is computed in closed form from the sorted argument itself, so NN values occupy NN slots, the argument is recoverable from the index, and the table can be memory-mapped and served from a file larger than RAM. Against a chained hash map it uses 5.7×5.7\times less memory at 3737M entries and 10.2×10.2\times less at 1.91.9B, answers queries up to 2.9×2.9\times faster and builds up to 250×250\times faster; on 64 threads its construction needs no coordination; a sharded hash gains only 1.17×1.17\times. Against an open-addressing table with inline keys it is 44--7×7\times smaller and 100×100\times faster to build but 1.5×1.5\times slower to query, a deficit we trace to the O(d)O(d) index arithmetic. At 2222 GB on a 1616 GB desktop it serves each query in one disk access, where no key-storing container can be built; and its order-preserving addressing keeps a perturbation workload on the same pages that a hashed layout scatters. The closed form exists because the key set is the multiset combinations, whose index is the combinatorial number system. Memoizing Plackett--Luce normalization runs 2525--55×55\times faster than Newton's method; memoizing αα-entmax thresholds does not pay. The contrast says when this structure is worthwhile.

Explore similar work

CardsList