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.

3 Responses to “Optimizing stuff again”

  1. chat-loupe Says:

    Youpi ^_^
    (even if I don’t understand what you say :-p %f is slow ?? )

  2. Colin Says:

    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 !

  3. chat-loupe Says:

    Il fallait y penser ! Bravo.

Leave a Reply

news for few, stuff no-one cares about