Task #36207

Speed up performance in format.currency

Added by Ingo Pfennigstorf over 9 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
ViewHelpers
Target version:
-
Start date:
2012-04-17
Due date:
% Done:

100%

Estimated time:
Has patch:
No

Description

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

#1

Updated by Christian Kuhn over 9 years ago

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

#2

Updated by Gerrit Code Review over 8 years 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

#3

Updated by Alexander Berl over 8 years 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.

#4

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch 2.0 of project Packages/TYPO3.Fluid has been pushed to the review server.
It is available at https://review.typo3.org/27195

#5

Updated by Alexander Berl over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF