Optimize TitleFormatter::getPrefixedText() to Title performance
authorKunal Mehta <legoktm@member.fsf.org>
Sat, 18 Aug 2018 00:26:26 +0000 (17:26 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sat, 18 Aug 2018 00:43:52 +0000 (17:43 -0700)
commitd0f56e873d6b06bae7fedbd203f60c4261cb2fbe
treead220c9006a02ba6e5833394e0b2286c0c1f9bf2
parent63b2003520134dd3bc90ade3ad0c78d96461cff6
Optimize TitleFormatter::getPrefixedText() to Title performance

...by instance caching the result on the LinkTarget object.

Title::getPrefixedText() is an extremely hot function that has been
fully optimized over the years due to its usage basically everywhere in
MediaWiki.

Apply the same treatment to TitleFormatter, but keep the caching as part
of the LinkTarget instance so we can share caches across Title and
TitleFormatter. Once Title is switched over to using TitleFormatter
internally, we can probably centralize the cache again, and get rid of
the public but marked @private member variables.

Bug: T201801
Change-Id: I4ae2d6b176f69f66720473aeae85e39a601a9781
includes/Title.php
includes/title/MediaWikiTitleCodec.php
includes/title/TitleValue.php