Sebastien Mondet avatar 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.