samtools/htsjdk — pull request #5 by BeatWolf (2014-05-13 09:50:48+00:00)
Title: AbstractBAMFileIndex.query optimization by caching sequenceIndex positions

While optimizing AbstractBAMFileIndex.query i noticed that quite a lot of time was spent in skipToSequence.
I added a cache that stores the position at which each sequence is stored. As the number of sequences should be "reasonably" low in a bam file (lets say less than a few 1000) the memory overhead should be minimal. In my usecase i got a 20% speed improvement. The usecase being many getSpanOverlapping requests on a low coverage BAM file.

This patch is a little bit more invasive than my other patch. Mainly because the position() of the Index is not exposed and i had to add an access to it. At the same time i added a few missing @Override in the different Index implementations. I can of course remove them from this pull request if this is not wanted.