[gdal-dev] How to make my GDAL code faster?

Frank Warmerdam warmerdam at pobox.com
Wed Apr 15 11:03:40 EDT 2009


Nicolas DEGARNE wrote:
> I read on help and /gdal.h/ File Reference that it could exist faster 
> way so I have some ideas like :       
>              Merging the code to c++
>              Using Read/Write block
>              Use Tile/Block to accelerate the process
>              Use the Warpprocess to calulate windows mean's faster
> 
> I hope you understand my request and it was clear
>         

Nicolas,

My advice would be to read an entire 5 line swath into a buffer, and
then operate within that buffer.  Very small read/write operations
are pretty expensive with GDAL and your approach of reading five pixels
off one line as a single request is very very fine grained.

Switching to C++ will not help noticably (just reducing one level of
function call overhead, and a bit of extra checking the C API provides).

At this point there is little value in going to exact TIFF tiles or using
the block API.

The Warp API is also going to be very high overhead to compute means.

Once you overhaul things to operate on substantial swaths of data, there
may also be some other opportunities for optimizing within your algorithm
(rolling means, for instance) but first solve the big IO overhead bottleneck.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list