precompute tables