Only apply substitution patterns related to key values that appear in
the string.
Replace .*? in patterns with more explicit patterns that don't require
backtracing.
Add a performance test script for future testing work, with references
to large data files that can be downloaded but that we don't want to
check into the source repository because of their sizes.
Change-Id: Ic3ed252d181c93b8a0db465db6c8c4a7ca97da42
Related-bug: #1408362