[Proj] pj_transform performance issue
Herve Baille
hb at meteorage.com
Mon Nov 12 09:54:45 EST 2007
Hi
We are new in development using proj4.
We used to develop our own C libraries and would like to use Proj4, but
we experienced a strange performance problem.
We initialize the projections with:
pj_in = pj_init_plus("+init=epsg:4019");
pj_out = pj_init_plus("+init=epsg:27572");
Then we loop 100000 times on the function call:
for (i=0 ; i<nbloop ; i++) {
pj_transform(pj_in, pj_out, 1, 0, &x, &y, 0);
}
We get the (correct) result in about 6 seconds.
Now we just integrate this call into a function
int trans(projPJ pj_in, projPJ pj_out, double x, double y)
{
pj_transform(pj_in, pj_out, 1, 0, &x, &y, 0);
return(0);
}
and call this function in the loop,
for (i=0 ; i<nbloop ; i++) {
trans(pj_in, pj_out, x, y);
}
then we get the (still correct) result in 30 seconds!
Now, if I pass the coordiantes of my intermediate function, by address
instead of by values,
int trans(projPJ pj_in, projPJ pj_out, double *x, double *y)
{
pj_transform(pj_in, pj_out, 1, 0, x, y, 0);
return(0);
}
We get the result in 6 seconds again.
What could be the reason for such a performance ratio?
What are the rules to optimize pj_transform function?
Off course we need to use a function between the loop and the
pj_transform call.
Thanks for any help
Best regards
Herve Baille
--
***************************
Hervé BAILLE <herve.baille at meteorage.com>
Software development manager
Sté Météorage
2 av Angot
64053 PAU
France
CATS support <support at meteorage.com>
***************************
More information about the Proj
mailing list