The image below shows the approximate performance of:
fpm
(the Q16.16
type)fix16
), an alternative C library (see notes).CNL
), an experimental library that is being developed in C++’s SG14.float
and double
).The graph below plots the average number of nanoseconds a single operation takes: lower is better. The data was collected with Google Benchmark on an Intel Core i7-5820K, 3.3GHz.
The results show the following:
libfixmath
, the performance of fpm
is at least as good, except for exp
, where it’s considerably slower.fpm
only matches the performance for sqrt
. However, CNL does not support the majority of benchmarked functions.fpm
is slower by up to an order of magnitude for most functions, except for the basic add
, sub
and several power or trigonometry functions, where it is faster.For a fair comparison, libfixmath
was compiled with FIXMATH_NO_CACHE
.
It should also have been compiled with FIXMATH_NO_OVERFLOW
(since fpm
does not detect overflow), but libfixmath
failed to compile with that option.