Cache result of ContentReference.ToString

Fixed in

EPiServer.CMS.Core 11.20.0

Created

Aug 19, 2020

Updated

Oct 08, 2020

Area

CMS Core

State

Closed, Fixed and tested


Description

ContentReference.ToString does normally many string concatenations, which should be possible to optimize by caching the returned value, even if the instance is not readonly.

It appears to be used alot in core parts of the cms, so the impact could be significant.
For example, it amounts to ~10% of memory allocations in GetItems (tested with given_that_several_pages_is_created_and_cache_is_used, see image)