Skip to content

Commit

Permalink
Merge pull request #124 from inhabitedtype/bench-safe-string
Browse files Browse the repository at this point in the history
bench-safe-string: use bytes instead of string as read buffer
  • Loading branch information
seliopou authored Jan 14, 2018
2 parents 75e2042 + bf57f84 commit c060822
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions benchmarks/pure_benchmark.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ open Core_bench
let read file =
let open Unix in
let size = Int64.to_int_exn (stat file).st_size in
let buf = String.create size in
let buf = Bytes.create size in
let rec loop pos len fd =
let n = read ~pos ~len ~buf fd in
if n > 0 then loop (pos + n) (len - n) fd
in
with_file ~mode:[O_RDONLY] file ~f:(fun fd ->
loop 0 size fd);
Bigstring.of_string buf
Bigstring.of_bytes buf
;;

let zero =
Expand Down

0 comments on commit c060822

Please sign in to comment.