[gdal-dev] ReadBlock vs. RasterIO performance
Frank Warmerdam
warmerdam at pobox.com
Fri Mar 7 11:58:49 EST 2008
Gregory, Matthew wrote:
> Hi list,
>
> In reading through the previous posts on this topic, I see that
> ReadBlock() and RasterIO() should have very similar performance (with
> RasterIO() actually doing better when blocks are cached and accessed
> multiple times). But in doing a very simple test (ie. reading a
> relatively large single-band GTiff (8000x13000) 200 times), ReadBlock()
> seems to be much faster than RasterIO().
>
> ReadBlock() : 21 seconds
> RasterIO() : 87 seconds
>
> Here is the relevant code:
...
>
> 1) Am I (likely) doing something incredibly stupid or is this expected?
Matt,
I see no obvious problem in your methodology. In this case I'm not
surprised the ReadBlock() is a bit faster, but I'm shocked at the
amount of difference.
The RasterIO() case is presumably not benefitting at all from it's
attempts to cache blocks because by the time it gets to the bottom
of a 8000 x 13000 image it has likely discarded the top cached blocks.
So all that cache maintenance work does not good.
But still, it should really just amount to a bit of cache management
and perhaps an extra copy or two of data. I don't know why it is so
slow. I think I shall have to do some testing myself.
> 2) Would you expect differences for different drivers?
Yes. Driver implementation techniques vary substantially and there
can be very different performance characteristics.
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 | President OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list