Task #50484
closedGenerating URLs takes very long
0%
Description
Hi all
We found out that generating simple URLs using $cObj->typoLink_URL() or $this->uriBuilder->uriFor() in ExtBase plug-ins take very long compared to other frameworks like Zend.
Time for creating 100 URLs without RealURL:
- standard URLs: 113.239050ms
- absolute URLs: 123.664141ms
- with CHash: 110.864878ms
- without CHash: 87.856054ms
Time for creating 100 URLs with RealURL:
- standard URLs: 194.674969ms
- absolute URLs: 205.719948ms
- with CHash: 193.242073ms
- without CHash: 168.409109ms
Even when disabling RealURL, more than 100ms are necessary to generate 100 URLs while the Zend Framework needs around 10ms to do the same. Usually, product lists in e-commerce sites generate a lot of similar URLs. Is there a possibility to speed up generating the URLs by using some sort of caching?
For testing, I've used a modified version of the efempty plugin and the relevant code is:
public function urlAction()
{
$results = array();
$results[] = 'Time for creating 100 URLs:';
$start = microtime( true );
for( $i = 0; $i < 100; $i++ ) {
$this->uriBuilder->reset()->uriFor( 'url', array(), 'Start' );
}
$results[] = sprintf( '- standard URLs: %1$fms', ( microtime( true ) - $start ) * 1000 );
$start = microtime( true );
for( $i = 0; $i < 100; $i++ ) {
$this->uriBuilder->reset()->setCreateAbsoluteUri( true )->uriFor( 'url', array(), 'Start' );
}
$results[] = sprintf( '- absolute URLs: %1$fms', ( microtime( true ) - $start ) * 1000 );
$start = microtime( true );
for( $i = 0; $i < 100; $i++ ) {
$this->uriBuilder->reset()->setUseCacheHash( true )->uriFor( 'url', array(), 'Start' );
}
$results[] = sprintf( '- with CHash: %1$fms', ( microtime( true ) - $start ) * 1000 );
$start = microtime( true );
for( $i = 0; $i < 100; $i++ ) {
$this->uriBuilder->reset()->setUseCacheHash( false )->uriFor( 'url', array(), 'Start' );
}
$results[] = sprintf( '- without CHash: %1$fms', ( microtime( true ) - $start ) * 1000 );
return join( '<br/>', $results );
}
Best regards,
Norbert
Files