ruby/ruby — pull request #497 by dbussink (2014-01-06 12:37:30+00:00)
Title: Cache multiple compiled regexps

This caches compiled versions of different encoded regular expressions.
This helps performance wise in cases where the same regular expression
gets used against different encodings.

In Rails this is a pretty common scenario if templates with user
generated content sometimes only contain ASCII characters, other times
binary and sometimes UTF-8.

This caches the encodings with the lowest three encoding id's, which is
US-ASCII, BINARY and UTF-8. They are also the most commonly used and
provides a compromise between additional size usage and performance.