Build the link with an i memory cache that reduces the amount of required typolink calls.

@param integer $pageUid
@param array $arguments
@return string
489425
protected function buildLinkWithInMemoryCache($pageUid, array $arguments)
    {
        $values = [];
        $structure = $arguments;
        $this->getSubstitution($structure, $values);
        $hash = md5($pageUid . json_encode($structure));
        if (isset(self::$preCompiledLinks[$hash])) {
            self::$hitCount++;
            $uriCacheTemplate = self::$preCompiledLinks[$hash];
        } else {
            self::$missCount++;
            $this->uriBuilder->setTargetPageUid($pageUid);
            $uriCacheTemplate = $this->uriBuilder->setArguments($structure)->setUseCacheHash(false)->build();

            // even if we call build with disabled cHash in TYPO3 9 a cHash will be generated when site management is active
            // to prevent wrong cHashes we remove the cHash here from the cached uri template.
            // @todo: This can be removed when https://forge.typo3.org/issues/87120 is resolved and we can ship a proper configuration
            $urlHelper = GeneralUtility::makeInstance(UrlHelper::class, $uriCacheTemplate);
            $urlHelper->removeQueryParameter('cHash');
            $uriCacheTemplate = $urlHelper->getUrl();

            self::$preCompiledLinks[$hash] = $uriCacheTemplate;
        }

        $keys = array_map(function($value) {
            return urlencode($value);
        }, array_keys($values));
        $values = array_map(function($value) {
            return urlencode($value);
        }, $values);
        $uri = str_replace($keys, $values, $uriCacheTemplate);
        return $uri;
    }
377375
private static function getCacheKey($ids, $buildDepth, $orderby=null, PagingInfo $pagingInfo=null) {
    $result = is_array($ids) ? join(',', $ids) : $ids;
    $result .= ','.$buildDepth;
    if ($orderby != null) {
      $result .= ','.(is_array($orderby) ? join(',', $orderby) : $orderby);
    }
    if ($pagingInfo != null) {
      $result .= ','.$pagingInfo->getOffset().','.$pagingInfo->getPageSize();
    }
    return md5($result);
  }
88245
private function buildUrl($resource, $args)
    {
        //Merge args(apiKey, Format, noJsonCallback)
        $args = array_merge($args, $this->args);
        $query = http_build_query($args);

        $url = $this->url;
        $url .= $resource . '?' . $query;

        return $url;
    }
222924
public function linksToCurrentPage(array $arguments) {
        return
            URL::current() == URL::route($this->action->getName(), $this->action->getRouteParameters($arguments)) &&
            Request::method() == $this->action->getMethod();
    }
1151504
public function getPresignedUrl(string $filename, $expires): GetPresignedUrlCommand
    {
        /** @var GetPresignedUrlCommand $command */
        $command = $this->builder->build(GetPresignedUrlCommand::class);
        $command->byFilename($filename)->withExpiration($expires);

        return $command;
    }
542540
function build($url,$args=[]) {
		$args+=$this->hive['PARAMS'];
		if (is_array($url))
			foreach ($url as &$var) {
				$var=$this->build($var,$args);
				unset($var);
			}
		else {
			$i=0;
			$url=preg_replace_callback('/@(\w+)|(\*)/',
				function($match) use(&$i,$args) {
					if (isset($match[1]) &&
						array_key_exists($match[1],$args))
						return $args[$match[1]];
					if (isset($match[2]) &&
						array_key_exists($match[2],$args)) {
						if (!is_array($args[$match[2]]))
							return $args[$match[2]];
						$i++;
						return $args[$match[2]][$i-1];
					}
					return $match[0];
				},$url);
		}
		return $url;
	}
1212286
public function buildTags(
        $pageType,
        $parameters = array()
    ) {
        if ($this->settingsManager->isMobileHeaderDisabled()) {
            return '';
        }

        $parameters = $this->siteParameters + $parameters;

        $parameters['link_tags']     = $this->tagsGenerator->getTagsFor($pageType, $parameters);
        $parameters['redirect_code'] = $this->getRedirectCode($pageType);
        $parameters['shop_number']   = $this->shopNumber;
        $parameters                  += $this->settingsManager->getShopgateStaticUrl();

        // pre-process the additional parameters to add in the correct JS variables
        $variable = new Shopgate_Model_Redirect_HtmlTagVariable();
        $variable->setName('additional_parameters');
        $jsTemplate = $this->templateParser->process(
            @file_get_contents($this->jsTemplateFilePath),
            $variable,
            $this->getAdditionalParameters($pageType)
        );

        // process all variables left in the template (and those added with the processing of 'additional_parameters'.
        $variables = $this->templateParser->getVariables($jsTemplate);
        foreach ($variables as $variable) {
            $replacement = !empty($parameters[$variable->getName()])
                ? $parameters[$variable->getName()]
                : '';

            $jsTemplate = $this->templateParser->process($jsTemplate, $variable, $replacement);
        }

        return $jsTemplate;
    }
507470
public function getAbsoluteUrl(array $params = array())
	{
		if ( !is_object($this->urlBuilder) ) {
			throw new PageException(
				'The url builder of a page not set, have you used @page-url annotation?',
				PageException::TYPE_MISSING_URL_BUILDER
			);
		}

		return $this->urlBuilder->build($params);
	}
939300
protected function rewriteUrls($text, $pageUrl)
    {
        $relative = $this->baseurl === './';
        if ($relative || $this->uglyurls) {
            // Match restrictively urls starting with prefix, and which are
            // correctly escaped (no whitespace or quotes).
            $find = preg_quote(static::URLPREFIX) . '(\/?[^\?\&<>{}"\'\s]*)';
            $text = preg_replace_callback(
                "!$find!",
                function($found) use ($pageUrl, $relative) {
                    $url = $found[0];
                    if ($this->uglyurls) {
                        $path = $found[1];
                        if (!$path || $path === '/') {
                            $url = rtrim($url, '/') . '/index.html';
                        }
                        elseif (!Str::endsWith($url, '/') && !pathinfo($url, PATHINFO_EXTENSION)) {
                            $url .= $this->extension;
                        }
                    }
                    if ($relative) {
                        $pageUrl .= $this->extension;
                        $pageUrl = str_replace(static::URLPREFIX, '', $pageUrl);
                        $url = str_replace(static::URLPREFIX, '', $url);
                        $url = $this->relativeUrl($pageUrl, $url);
                    }
                    return $url;
                },
                $text
            );
        }
        // Except if we have converted to relative URLs, we still have
        // the placeholder prefix in the text. Swap in the base URL.
        $pattern = '!' . preg_quote(static::URLPREFIX) . '\/?!';
        return preg_replace($pattern, $this->baseurl, $text);
    }
37490
protected function postLinks($arrows = true) {
        $paging = '';
        if (self::$current != self::$totalPages && $arrows) {
            $paging .= $this->buildLink((self::$current + 1), '&gt;');
            if (self::$current != (self::$totalPages - 1)) { $paging .= $this->buildLink(self::$totalPages, '&raquo;'); }
        }
        return $paging;
    }
669237
protected function getTemplateLayoutsFromTsConfig($pageUid)
    {
        $templateLayouts = [];
        $pagesTsConfig = BackendUtility::getPagesTSconfig($pageUid);
        if (isset($pagesTsConfig['tx_dvoconnector.']['templateLayouts.']) && is_array($pagesTsConfig['tx_dvoconnector.']['templateLayouts.'])) {
            $templateLayouts = $pagesTsConfig['tx_dvoconnector.']['templateLayouts.'];
        }
        return $templateLayouts;
    }
132738
public static function getQueryTemplate($template, ...$arguments)
    {
        $strQuery = $template;
        foreach ($arguments as $i => &$argument) {
            $strQuery = str_replace('%' . $i, $argument, $strQuery);
        }

        return $strQuery;
    }
1290428
static function PageUrl(Page $page, array $params = array(), $fragment = '')
    {
        $siteUrl = $page->GetSite()->GetUrl();
        $pageUrl = $page->GetUrl();
        if ($pageUrl == 'index.html') {
            $url = $siteUrl;
        }
        else {
            $url = Path::Combine($siteUrl, $pageUrl);
        }

        $oblParams = self::GatherParams($url);
        $urlObl = self::AttachObligatoryParams($url, $oblParams, $params);

        $urlAllParams = self::AttachMoreParams($urlObl, $oblParams, $params);
        return $fragment ? $urlAllParams . '#' . $fragment : $urlAllParams;
    }
47393
private function cacheKey(Route $route, array $args) : string
    {
        switch (gettype($route->getController())) {
            case 'string':
                $controller = $route->getController();
                break;

            case 'array':
                $controller = implode('::', $route->getController());
                break;

            default:
                if (is_callable($route->getController())) {
                    $controller = 'callable_' . spl_object_hash($route->getController());
                } else {
                    throw new \LogicException('Unexpected type');
                }
        }

        return $controller . '(' . json_encode($args) . ')';
    }
41852
public function url( array $args = []) {
        $url = get_comments_link( $this->post_ID );
        if ( $args ) {
            $url = add_query_arg( $args, $url );
        }

        return $url;
    }
1250638
public function createCacheBustedUrl(string $fileName, string $content): string
    {
        // For url we need to cache it
        $cacheFile = $this->createPublicCacheFile($fileName, $content);
        $name = pathinfo($cacheFile, PATHINFO_BASENAME);
        $dir = pathinfo($cacheFile, PATHINFO_DIRNAME);
        $dirs = explode('/', $dir);

        // Folder: cache/ab
        $cacheDirs = array_slice($dirs, count($dirs) - 2);

        // Folder: cache/ab/filename.ext
        return implode('/', $cacheDirs) . '/' . $name;
    }
108501
public function getPageItemChangedTimeByPageUid(int $pageUid)
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder->getRestrictions()->removeAll();
        $pageContentLastChangedTime = $queryBuilder
            ->add('select', $queryBuilder->expr()->max('tstamp', 'changed_time'))
            ->from('tt_content')
            ->where(
                $queryBuilder->expr()->eq('pid', $pageUid)
            )
            ->execute()->fetch();

        return $pageContentLastChangedTime['changed_time'];
    }