Use of Python with GDAL. How to speed up ?
Kent Johnson
kent at kentsjohnson.com
Wed Mar 22 08:28:57 EST 2006
Julien Fiore wrote:
> Thanks Caleb for the advice,
>
> I profiled my code with the following lines:
>
> import profile, pstats
>
> profile.runctx('openness(infile,outfile,R)',globals(),locals(),'profile.log')
> p = pstats.Stats('profile.log')
> p.sort_stats('time')
> p.print_stats(10)
>
> The outputs tells me that the openness() function takes most of the
> time. This is not very useful for me, as openness() contains most of my
> code. How to know which instructions take most time in the openness
> function ? Do I have to separate the code into smaller functions ?
Yes. The profiler collects statistics for functions, not for individual
lines of code.
Kent
More information about the Python-list
mailing list