Commits

Sebastien Mondet committed 0276a75

Add an experiment with BatIO.nread

Comments (0)

Files changed (1)

   let tr = Biocaml_fastq.enum_parser ~filename:file  in
   BatEnum.hard_count (tr e4buf)
   
+let enum_asking_for_buffer_size ~buffer_size file =
+  let i = BatFile.open_in file in
+  let e = BatEnum.from (fun () ->
+    try
+      BatIO.nread i buffer_size 
+    with
+      BatIO.No_more_input -> raise BatEnum.No_more_elements) in
+  let tr = Biocaml_fastq.enum_parser ~filename:file  in
+  BatEnum.hard_count (tr e)
     
 let do_bench exp_name repetitions buffer_sizes files =
   Lwt_io.printf "{section|Benchmark %S}\n\
     bench_non_lwt enum_transform_counter_with_lines_of
       "{t|File.lines_of |> Biocaml_fastq.enum_parser |> Enum.hard_count}"
     >>= fun () ->
+    Lwt_list.iter_s (fun buffer_size ->
+      bench_non_lwt (enum_asking_for_buffer_size ~buffer_size)
+        (sprintf
+           "{t|BatIO.nread %d |> Biocaml_fastq.enum_parser |> Enum.hard_count}"
+           buffer_size)) buffer_sizes
+    >>= fun () ->
 
     Lwt_io.printf "{end}{p}\n"
   ) files