LanguageConverter performance: Reuse the same string object for regexp
authorC. Scott Ananian <cscott@cscott.net>
Tue, 2 Jul 2019 18:04:39 +0000 (14:04 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Tue, 2 Jul 2019 18:32:01 +0000 (14:32 -0400)
The regular expression used by LanguageConverter::autoConvert() is a
constant, but it is being created on-the-fly by every invocation.
This causes an expensive full-string comparison when the compiled
regular expression is fetched from the cache -- since the regex is 332
bytes long, the time taken for this comparison can add up quickly: on
page with a lot of tags, the regexp cache may spend more time looking
up the regexp than it takes to execute it.

Bug: T223969
Change-Id: I53c3e631e47a791cf3f0844dd79d4357605c59e3


No differences found