Skip to content

Commit feb64f3

Browse files
committed
Fix compatibility with ocaml4.08
1 parent 8d07c3e commit feb64f3

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

bench/bench.ml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,15 @@ let make_tests (type v) (module Protoc: Protoc_impl) (module Plugin: Plugin_impl
6565
let test_encode =
6666
Test.make_grouped ~name:"Encode"
6767
[
68-
Test.make ~name:"Plugin balanced" (Staged.stage @@ fun () -> Plugin.M.to_proto' Ocaml_protoc_plugin.Writer.(init ~mode:Balanced ()) v_plugin |> Ocaml_protoc_plugin.Writer.contents |> Sys.opaque_identity);
69-
Test.make ~name:"Plugin speed" (Staged.stage @@ fun () -> Plugin.M.to_proto' Ocaml_protoc_plugin.Writer.(init ~mode:Speed ()) v_plugin |> Ocaml_protoc_plugin.Writer.contents |> Sys.opaque_identity);
70-
Test.make ~name:"Plugin space" (Staged.stage @@ fun () -> Plugin.M.to_proto' Ocaml_protoc_plugin.Writer.(init ~mode:Space ()) v_plugin |> Ocaml_protoc_plugin.Writer.contents |> Sys.opaque_identity);
71-
Test.make ~name:"Protoc" (Staged.stage @@ fun () -> let encoder = Pbrt.Encoder.create () in Protoc.encode_pb_m v_protoc encoder; (Pbrt.Encoder.to_string encoder) |> Sys.opaque_identity)
68+
Test.make ~name:"Plugin" (Staged.stage @@ fun () -> Plugin.M.to_proto' Ocaml_protoc_plugin.Writer.(init ()) v_plugin);
69+
Test.make ~name:"Protoc" (Staged.stage @@ fun () -> let encoder = Pbrt.Encoder.create () in Protoc.encode_pb_m v_protoc encoder; Pbrt.Encoder.to_string encoder)
7270
]
7371
in
7472
let test_decode =
7573
Test.make_grouped ~name:"Decode"
7674
[
77-
Test.make ~name:"Plugin" (Staged.stage @@ fun () -> Plugin.M.from_proto_exn (Ocaml_protoc_plugin.Reader.create data_plugin |> Sys.opaque_identity));
78-
Test.make ~name:"Protoc" (Staged.stage @@ fun () -> Protoc.decode_pb_m (Pbrt.Decoder.of_string data_protoc |> Sys.opaque_identity))
75+
Test.make ~name:"Plugin" (Staged.stage @@ fun () -> Plugin.M.from_proto_exn (Ocaml_protoc_plugin.Reader.create data_plugin));
76+
Test.make ~name:"Protoc" (Staged.stage @@ fun () -> Protoc.decode_pb_m (Pbrt.Decoder.of_string data_protoc))
7977
]
8078
in
8179
Test.make_grouped ~name:(Plugin.M.name' ()) [test_encode; test_decode]
@@ -134,12 +132,12 @@ let create_test_data ~depth () =
134132
let benchmark tests =
135133
let open Bechamel in
136134
let instances = [ meassure ] in
137-
let cfg = Benchmark.cfg ~limit:500 ~quota:(Time.second 5.0) ~kde:(Some 100) ~stabilize:true ~compaction:false () in
135+
let cfg = Benchmark.cfg ~compaction:false ~kde:(Some 1) ~quota:(Time.second 1.0) () in
138136
Benchmark.all cfg instances tests
139137

140138
let analyze results =
141139
let open Bechamel in
142-
let ols = Analyze.ols ~bootstrap:5 ~r_square:false
140+
let ols = Analyze.ols ~bootstrap:5 ~r_square:true
143141
~predictors:[| Measure.run |] in
144142
let results = Analyze.all ols meassure results in
145143
Analyze.merge ols [ meassure ] [ results ]

src/ocaml_protoc_plugin/deserialize.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ let default_value: type a. a spec -> a = function
100100
| SFixed32 -> Int32.zero
101101
| SFixed64 -> Int64.zero
102102
| Message of_proto -> of_proto (Reader.create "")
103-
| String -> String.empty
103+
| String -> ""
104104
| Bytes -> Bytes.empty
105105
| Int32_int -> 0
106106
| Int64_int -> 0

0 commit comments

Comments
 (0)