anchor.diff:          count
   
   module PSeqOrdered =
  +
       let map (mapping:'a->'b) (source:seq<'a>) =
           source.AsParallel().AsOrdered().Select(mapping)
   
  
positive.code:         let root = @"D:\a\data\marspec\MARSPEC_10m\ascii\"
          let paths = Directory.GetFiles(root, "*.asc")
          testRandomQuery "testAllMarspec10m" paths 100 1000 |> ignore
          // 39s 10000 * 10
          // 22s 1000 * 100
          // 18s 100 * 1000
  
  
      let testGebco() =
          ignore // TODO
  
  module Test =
      let runall() =
          SimpleReadWrite.test()
          AsciiToBin.testSmallMarspec()
          AsciiToBin.testAllMarspec10m()
  Test.runall()
  
negative.code:         use writer = new BinaryWriter(File.Open(fileName, FileMode.OpenOrCreate))
          values
          |> Seq.iter (writeValue writer)
      
      let cache = Dictionary<string, BinaryReader>()
      let clearCache() =
          for key in cache.Keys do
              cache.[key].Dispose()
          cache.Clear()
      let getreader fileName =
          if cache.ContainsKey(fileName) then cache.[fileName]
          else 
              let res = new BinaryReader(File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
              cache.[fileName] <- res
              res 
  
              
      let readValue (reader:BinaryReader) cellIndex = 
          // set stream to correct location
          reader.BaseStream.Position <- cellIndex*4L
          match reader.ReadInt32() with
          | Int32.MinValue -> None
          | v -> Some(v)
          
      let readValues fileName indices = 
          //use reader = new BinaryReader(File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
          let reader = getreader fileName
          // Use list or array to force creation of values (otherwise reader gets disposed before the values are read)
          let values = List.map (readValue reader) (List.ofSeq indices)
          values
  
  module MemoryMappedRead =
      open System.IO.MemoryMappedFiles
  
      let cache = Dictionary<string, MemoryMappedFile>()
      let clearCache() =
          for key in cache.Keys do
              cache.[key].Dispose()
          cache.Clear()
  
      let getmmf fileName =
          if cache.ContainsKey(fileName) then cache.[fileName]
          else 
              let res = MemoryMappedFile.CreateFromFile(fileName, FileMode.Open)
              cache.[fileName] <- res
              res 
  
      let readValue (reader:MemoryMappedViewAccessor) offset cellIndex =
          let position = (cellIndex*4L) - offset
          match reader.ReadInt32(position) with
          | Int32.MinValue -> None
          | v -> Some(v)
          
      let readValues fileName indices =
          //use mmf = MemoryMappedFile.CreateFromFile(fileName, FileMode.Open)
          let mmf = getmmf fileName
          let offset = (Seq.min indices ) * 4L
          let last = (Seq.max indices) * 4L
          let length = 4L+last-offset
          use reader = mmf.CreateViewAccessor(offset, length, MemoryMappedFileAccess.Read)
          let values = (List.ofSeq indices) |> List.map (readValue reader offset)
          values
  
  module AsciiToBin =
  
  