spectralpython/spectral — pull request #5 by ohspite (2014-05-04 07:45:57+00:00)
Title: swap order of loops in BilFile.read_bands()

This branch switches the inner and outer loops in the `read_bands()` function for BIL files.

I profiled the change by loading two different sets of bands using memmap, the current implementation, and the new loop order. I did the tests on an internal SSD and a USB 3.0 drive. Between tests I flushed the disk cache using `sync && echo 3 | sudo tee /proc/sys/vm/drop_caches`. All times are averages of three runs, in seconds, in wall time (`time.time()`).

```
loading all 200 bands SSD USB drive
with memmap: 28.6 80.9
original loop order: 8.0 62.5
revised loop order: 2.6 20.1

loading bands [0,100,219] SSD USB drive
with memmap: 1.2 19.3
original loop order: 1.2 19.1
revised loop order: 1.3 9.9
```

I'd be curious to know if this is similar to the performance you see with memmap. If so, maybe memmap should not be used for BIL or BIP `read_bands()`?