freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] On rounding errors


From: James Cloos
Subject: [ft-devel] On rounding errors
Date: Thu, 18 Jul 2013 06:36:22 -0400
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

I couldn't sleep, so I wrote some test code to see the difference from
the change Alexei suggested in:

http://lists.nongnu.org/archive/html/freetype-devel/2013-02/msg00031.html

ie, from:

    q3 = r1 = (q2+r2)/2

to:

    q3 = r1 = (p1 + 2*p2 + p3)/4

and found that, on x86, the change adds just a single leal instruction,
which should cost no more than 1-3 ticks, depending on processor.

Testing, however, showed that the changed code often ran faster,
depending on the values of p1, p2 and p3.

Either way, the differences were on the order of +- 5-25 microseconds
per loop, at 800 MHz.  (A run of 1000 loops wasn't enough to trigger
the cpu governor.)

Compiling with armv7a-hardfloat-linux-gnueabi-gcc-4.8.0 -S, the
difference was one extra (four arg) add instruction, the fourth
arg being an asl.

For mips64, with gcc-4.5, it added one addu and one sll.  For sparc64,
with gcc-4.6, the new code adds 2 calls to add, but removes two calls to
srl and removes one call to stx, for a net reduction of one instruction.

It looks like the more correct code should not slow freetype enought to
notice, and for some architectures and fonts may improve performance.

-JimC
-- 
James Cloos <address@hidden>         OpenPGP: 1024D/ED7DAEA6



reply via email to

[Prev in Thread] Current Thread [Next in Thread]