Skip to content

Commit b3e7eac

Browse files
committed
Optimize multi-file implementation
1 parent 1ab4b58 commit b3e7eac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/db_benchmark/multi_file_impl.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ module Make () : Common.Database = struct
2424

2525
let set_block t ~block_num values =
2626
let path = block_path t block_num in
27-
(* Concatenate all values and write in a single operation *)
28-
let concatenated = String.concat ~sep:"" values in
29-
Out_channel.write_all path ~data:concatenated
27+
(* Write all values directly to file without in-memory concatenation *)
28+
Out_channel.with_file path ~binary:true ~f:(fun oc ->
29+
List.iter values ~f:(Out_channel.output_string oc) )
3030

3131
let get t ~key =
3232
let block_num = block_of_key key in

0 commit comments

Comments
 (0)