UBM loop-allocation arithmetic ============================== Run with Node.js 22 or later. No packages or network access are needed. Keep model.mjs, model.test.mjs and examples.json in one directory. node model.mjs --check node --test model.test.mjs node model.mjs length: positive number of distinct loop blocks, integer up to 1,000,000. period: positive global block-reference count per repetition, at least length and at most 1,000,000. This is not seconds or the loop's private access count. buffers: integer allocation from 0 through 1,000,000. Marginal gain compares n with n-1; it is undefined (null) at n=0. The six examples are invented inputs. The event-count oracle enumerates three periods for 3,128 small configurations independently of the closed-form minimum. It checks the stated ideal allocation, not a cache replacement algorithm. No detector, phase changes, startup, mixed-loop allocation, fitted LRU curve, writeback, prefetch or device timing is modeled. Do not interpret the results as throughput, a benchmark, a first-reuse guarantee or a policy ranking. Method: Kim et al., OSDI 2000, section 3.3. https://www.usenix.org/legacy/event/osdi00/full_papers/kim/kim_html/index.html