anchor.diff:          printfn "max %d ms" (Array.max arr)
           printfn "sum %d ms" (Array.sum arr)
           result
  +
  +    let testSparseIndex() = 
  +        let r = new Random(1)
  +        
  +        let innerlen = 10000
  +        let indices = [1..innerlen] |> List.map (fun i -> (int64 (r.Next(0, 2160*1080)) ))
  +        let map = SparseReadWrite.readBitMap @"D:\temp\bathy_10m.sbm"
  +        let sw = Diagnostics.Stopwatch.StartNew()
  +        let result = indices |> Seq.map (BitMap.sparseIndex id map) |> Array.ofSeq
  +        sw.Stop()
  +        printfn "test sparse index %d ms" sw.ElapsedMilliseconds
  +        result
  +
       let testSimpleRandom = testRandomQuery AsciiProvider.convertToSimple Reader.simpleQuery
       let testSparseRandom = testRandomQuery AsciiProvider.convertToSparse Reader.sparseQuery 
       let testSmallMarspec() =
  
positive.code:         let count = countUpto uptoIndex b
          uptoIndex - count
  
      let sparseIndex (map:bitmap[]) (cellIndex:int64) =
          let ncols = int64 map.[0].Length
          let rowIndex = cellIndex / ncols
          let colIndex = (cellIndex - (rowIndex*ncols))
          if isSet colIndex map.[int rowIndex] then
              let skippedCount = map |> Seq.take (int rowIndex) |> Seq.map ((countSkippedUpto ncols)>>int64) |> Seq.sum
              let skippedCount = skippedCount + int64 (countSkippedUpto colIndex map.[int rowIndex])
              Some(cellIndex - skippedCount)
          else
              None
  
  
negative.code:         for i=0 to len-1 do
              sw.Restart()
              let indices = [1..innerlen] |> List.map (fun i -> (int64 (r.Next(0, 2160*1080)) ))
              //let indices = indices.OrderBy(fun x -> x)
              result <- Array.map (query indices) sbgPaths
              sw.Stop()
              arr.[i] <- sw.ElapsedMilliseconds
  
  