Topics / Precomputation and memoization
Performance topic
Precomputation and memoization
Move work out of the hot path: compute once at build or load time, cache results keyed by input, hoist invariants out of loops.
4,523proven techniques
149pitfalls: tried, then slower
1,215repositories
622from papers
Examples from real commits
servo/webrender
236×
Prerender a grid of tile repeats into a single texture and use a shader to sample it with modulo coordinates.
proof: commit →
duckdb/duckdb
10×
Maintain sliding window quantile state by reusing prior floor/ceiling and only re-partitioning when the replaced element affects the order statistic.
proof: commit →
NVIDIA/cudf
10×
Enable NVRTC pre-compiled headers (PCH) to skip C++ frontend parsing of static headers.
proof: commit →
mne-tools/mne-python
3.2×
Precompute sum of squares once; each permutation then needs only the signed column sum and a closed-form t-statistic.
proof: commit →
NVIDIA/DALI
2×
Cache each device's primary context handle once in a lazily initialized static table and switch with cuCtxSetCurrent instead of cudaSetDevice.
proof: commit →
AcademySoftwareFoundation/openvdb
1.7×
Precompute data-independent GF(2) shift operators on the host and upload them to the device.
proof: commit →
Luce-Org/lucebox
1.4×
Override speculative draft tokens with pre-tokenized structural hints when tool_choice constrains output.
proof: commit →
Languages
- C++1,903
- C540
- Rust490
- Python409
- Go165
- CUDA105
Hardware
- CPU1,061
- NVIDIA GPU407
- x86400
- GPU361
- ARM130
Fields
- general1,116
- graphics827
- data & compression735
- compilers574
- math542
Where these come from
Repositories with the most techniques on this topic in the database:
SanderMertens/flecs · 16oscar-system/Oscar.jl · 14screenpipe/screenpipe · 130xShug0/audio.cpp · 13o3de/o3de · 12inducer/loopy · 12TomClabault/HIPRT-Path-Tracer · 12sofa-framework/sofa · 12QEF/q-e · 12lupinemachines/lupine · 12
Ask Claude for the full answer
Each technique comes with its bottleneck, measured speedup, trade-offs, conditions and the commit or paper behind it, served to Claude through MCP.
claude mcp add --transport http adtomic https://www.adtomic.co/mcp
Related topics
Avoiding allocationsEarly exit and pruningBit tricks and strength reductionBatchingSpecialization, templates and JIT