[TYPO3-core] RFC #13645: Bug and Cleanup: t3lib_div::formatSize should use IEC prefixes and appropriate units

Sigfried Arnold s.arnold at rebell.at
Tue Mar 9 00:18:55 CET 2010


Here it comes, Version 3 of the Patch (done against latest trunk).

First: it follows the Suggestions: "IEC prefixes suck" and introduces 
three calculation methods:

traditional: base 1024 with SI like prefixes (default)
iec: base 1024 with IEC prefixes
si: base 1000 with SI prefixes

The default is hardcoded atm, but could be easily moved to config defaults.

So by adding this patch, nothing will change for existing TYPO3 
enviroments - 100% backwards compatible.

It's also around 30 % faster (tested with 10 Million runs with 
surpressed output by using ob_start/ob_end_clear), than the last patch i 
deliverd. It uses now a logarithmic function to dertermine the exponent, 
so the filesize does not affect the speed anymore.

This function is in my enviroment for around 1 week now (with different 
default values): no problems, works fine and perfect.

any comments on this one?

regards
Sigfried Arnold
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 13645_v3.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100309/585b1748/attachment.asc>


More information about the TYPO3-team-core mailing list