anchor.diff:              defaultValue
   
   module BitMap =
  -
  -    type bitmap = System.Collections.BitArray * int // map * skipped count
  +    type bitmap = bool [] * int64 // map * skipped count
       
       let ofArray (bools:bool []) = 
           let skippedCount = bools |> Seq.filter (not) |> Seq.length
  -        ((new System.Collections.BitArray(bools)), skippedCount):bitmap
  -    
  +        (bools, (int64 skippedCount)):bitmap
  +    
  +    let transform (b:bitmap []) = 
  +        let mutable total = 0L
  +        for i=0 to b.Length-1 do
  +            let (m,s):bitmap = b.[i] 
  +            total <- total+s
  +            b.[i] <- (m,total)
  +
       let init n (f:int->bool) = 
           let bools = Array.init n f
  -        ofArray bools    
  -
  -    let isSet index (b:bitmap) =
  -        (fst b).Get(int index)
  -
  -    let countUpto (uptoIndex:int64) (b:bitmap) = 
  -        let mutable count = 0L
  -        for i=0 to (int uptoIndex)-1 do
  -            if isSet i b then
  -                count <- count+1L
  -        count
  -
  -    let countSkippedUpto (uptoIndex:int64) (b:bitmap) =
  -        let count = countUpto uptoIndex b
  -        uptoIndex - count
  +        ofArray bools
   
       let sparseIndex sparseIndexConsumer (map:bitmap[]) (cellIndex:int64) =
           let ncols = int64 (fst map.[0]).Length
  -        let rowIndex = cellIndex / ncols
  -        let colIndex = (cellIndex - (rowIndex*ncols))
  -        if isSet (int colIndex) map.[int rowIndex] then
  -            let skippedCount = map |> Seq.take (int rowIndex) |> Seq.map (snd>>int64) |> Seq.sum
  -            let skippedCount = skippedCount + int64 (countSkippedUpto colIndex map.[int rowIndex])
  +        let rowIndex = int (cellIndex / ncols)
  +        let colIndex = int (cellIndex - ((int64 rowIndex)*ncols))
  +        if (fst map.[rowIndex]).[colIndex] then
  +            let mutable skippedCount = 0L
  +            if rowIndex > 0 then
  +                skippedCount <- (snd map.[rowIndex-1])
  +            let m = fst  map.[rowIndex]
  +            for i=0 to colIndex-1 do
  +                if not (m.[i]) then
  +                    skippedCount <- skippedCount+1L
  +
               Some(sparseIndexConsumer (cellIndex - skippedCount))
           else
               None
  
positive.code:         // 28s 1000 * 100
          // 10s 100*1000
          // 9s 100*1000 with MemoryMappedFile caching
          
      let testGebco() =
          ignore // TODO
  
negative.code:     
  module Reader =
      let simpleQuery indices fileName =
          //SimpleReadWrite.readValues fileName indices
          MemoryMappedSimpleRead.readValues fileName indices
  
      let sparseQuery indices fileName =
          SparseReadWrite.readValues fileName indices
  