I have here a regular UI call, and it triggers more than 90
API.getSegmentMetadata calls which then triggers calls to funnels, heatmaps, goals, ... That's a site with like 50 segments.
This is executed here: https://github.com/matomo-org/matomo/blob/4.5.0-b1/core/Segment.php#L186-L194
It's cached in a property but we often create a new segment instance like
new Piwik/Segment(). So the cache isn't really used and for every segment we create a new instance and fetch segment metadata over and over again.
This all can be quite slow.