25/08/2006 - Environ 1 minute de lecture Optimizing stuff again There was still room for improvement :-) _() for translation is slow %f is slow localtime() is slow – but there I didn’t find any workaround thousands of fread()/fwrite() is slow, mmap is faster.
Youpi ^_^
(even if I don’t understand what you say :-p %f is slow ?? )
Yes – sprintf(« %.2f », size), for example, used for filling the Size column, is really slow. « %.2f » is a format modifier meaning « float number with two digits after the comma ».
It’s faster to use sprintf(« %d.%d », a, b) and use a simple integer division to get the part before the comma, then a multiplication of the remainer by the rest, then a re-division to keep one number after the comma. – Faster enough to warrant the hassle !
Il fallait y penser ! Bravo.