Use map cache in non-debug code.

Resolves #278.