Task #36207
Speed up performance in format.currency
Status: | Resolved | Start date: | 2012-04-17 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | ViewHelpers | |||
Target version: | - | |||
Has patch: | No |
Description
Related to #34519 setting an empty default value for format.currency speeds this ViewHelper up
Associated revisions
[TASK] Optimize number_format calls
This change optimizes number_format calls in ViewHelpers by
explicitly casting the number argument to float.
A benchmark shows this increases performance of the number_format
call by a factor of 2-3.
Change-Id: I8e07703949ceb3781a101db80ee2b706d21a8f58
Releases: master, 2.0
Resolves: #36207
[TASK] Optimize number_format calls
This change optimizes number_format calls in ViewHelpers by
explicitly casting the number argument to float.
A benchmark shows this increases performance of the number_format
call by a factor of 2-3.
Change-Id: I8e07703949ceb3781a101db80ee2b706d21a8f58
Releases: master, 2.0
Resolves: #36207
History
#1 Updated by Christian Kuhn about 3 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 about 2 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 about 2 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 1 year 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 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e8ce12322f3f6cfde83f5e2589faf6a7a7dfa7c5.