Currently reply links are added in the `onOutputPageBeforeHTML` hook, and therefore not cached for logged-in users. While the median time spend in this hook is <50ms, on longer pages this can take a few hundred ms[1].
(At https://www.mediawiki.org/wiki/Topic:Vwtdrzx2hszbdul1 someone reported a page where adding reply links takes about 1.5 s.)
We should be able to store the output in the parser cache, so that this method is called much less frequently.
We will need to split the cache on user language as the reply link itself uses the user language.
=== Done
- [ ] @ppelberg to notify [@DarwIn](https://www.mediawiki.org/wiki/User:DarwIn) [here](https://www.mediawiki.org/w/index.php?title=Topic:Vwtdrzx2hszbdul1&topic_showPostId=vyl6e0wffpi1j5p9#flow-post-vyl6e0wffpi1j5p9) when done.
---
1. https://graphite.wikimedia.org/?width=586&height=308&target=MediaWiki.discussiontools.addReplyLinks.mean
=== Testing
* Check that the availability of the tool is unaffected by this patch, that it can be enabled/disabled via preferences or beta feature
* Check that the reply tool still loads correctly when enabled