[FOLD] Use std::map to optimize lookup performance
[FOLD] address Vinnie's comment
[FOLD] Calculate hashes without holding locks and cache the result