Task #36207

Speed up performance in format.currency

Added by Ingo Pfennigstorf about 1 year ago. Updated 5 days ago.

Status:Under Review Start date:2012-04-17
Priority:Should have Due date:
Assignee:- % Done:

0%

Category:ViewHelpers
Target version:-
Has patch:No
Votes: 0

Description

Related to #34519 setting an empty default value for format.currency speeds this ViewHelper up

History

Updated by Christian Kuhn 10 months ago

This micro optimization was now merged to v4 fluid with https://review.typo3.org/#/c/10443/ in ticket #34519

Updated by Gerrit Code Review 5 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20789

Updated by Alexander Berl 5 days ago

A quick bench with following code proves a simple explicit cast increases performance of that call by a factor of 2-3:

$stringToFormat = '  ';
$runs = 10000;

$start = microtime(true);
for ($i=0;$i<$runs;$i++) {
    @number_format($stringToFormat, 2, ',', '.');
}
echo "Don't cast: " . (microtime(true) - $start) . "\n";

$start = microtime(true);
for ($i=0;$i<$runs;$i++) {
    @number_format((float)$stringToFormat, 2, ',', '.');
}
echo "Explicit cast: " . (microtime(true) - $start) . "\n";

Note: The shutup operator is only used to prevent Warning messages from flooding the output.

Also available in: Atom PDF