Alberto Mardegan wrote:
Does one have any figure about how the performance of the FPU is,
compared to integer operations?
I added some profiling to the code, and I measured the time spent by a
function which is operating on an array of points (whose coordinates are
integers) and trasforming each of them into a geographic coordinates
(latitude and longitude, floating point) and calculating the distance
from the previous point.
http://vcs.maemo.org/git?p=maemo-mapper;a=shortlog;h=refs/heads/gps_control
map_path_calculate_distances() is in path.c,
calculate_distance() is in utils.c,
unit2latlon() is a pointer to unit2latlon_google() in tile_source.c
The output (application compiled with -O0):
double:
map_path_calculate_distances: 110 ms for 8250 points
map_path_calculate_distances: 5 ms for 430 points
map_path_calculate_distances: 109 ms for 8250 points
map_path_calculate_distances: 5 ms for 430 points
float:
map_path_calculate_distances: 60 ms for 8250 points
map_path_calculate_distances: 3 ms for 430 points
map_path_calculate_distances: 60 ms for 8250 points
map_path_calculate_distances: 3 ms for 430 points
float with fast FPU mode:
map_path_calculate_distances: 50 ms for 8250 points
map_path_calculate_distances: 2 ms for 430 points
map_path_calculate_distances: 50 ms for 8250 points
map_path_calculate_distances: 2 ms for 430 points
So, it seems that there's a huge improvements when switching from
doubles to floats; although I wonder if it's because of the FPU or just
because the amount of data passed around is smaller.
On the other hand, the improvements obtained by enabling the fast FPU
mode is rather small -- but that might be due to the fact that the FPU
operations are not a major player in this piece of code.
One curious thing is that while making these changes, I forgot to change
the math functions to there float version, so that instead of using:
float x, y;
x = sinf(y);
I was using:
float x, y;
x = sin(y);
The timings obtained this way are surprisingly (at least to me) bad:
map_path_calculate_distances: 552 ms for 8250 points
map_path_calculate_distances: 92 ms for 430 points
map_path_calculate_distances: 552 ms for 8250 points
map_path_calculate_distances: 91 ms for 430 points
Much worse than the double version. The only reason I can think of, is
the conversion from float to double and vice versa, but is it really
that expensive?
Anyway, I'll stick to using 32bit floats. :-)
--
http://www.mardy.it <- geek in un lingua international!
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers