While improving some Remarkup aspects and trying to do my best to avoid to build expensive PhutilURI objects... I've noticed that the PhabricatorEnv#isSelfURI() does not have a cache at the moment, and it always rebuilds its internal list of PhutilURI, every time you call the method.
Unclear where I should tag this. This may be just related to Performance and micro-optimizations.
Suggested unit tests, if you will ever work on this:
arc unit ./src/infrastructure/parser/__tests__/PhutilPygmentizeParserTestCase.php arc unit ./src/infrastructure/markup/remarkup/__tests__/PhutilRemarkupEngineTestCase.php