Rewrite memoization utils for lock-free anti-contention (better performance)