Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bench dependencies on core and core_bench. #117

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
- Removed deprecated `json` type aliasing type `t` which has been available
since 1.6.0 (@Leonidas-from-XIV, #100).

### Add

- Add an opam package `yojson-bench` to deal with benchmarks dependency
(@tmcgilchrist, #117)

## 1.7.0

*2019-02-14*
Expand Down
6 changes: 3 additions & 3 deletions bench/bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ let yojson_data = Yojson.Safe.from_string data
let large = 10_000

let large_int_assoc =
let ints = List.init large (fun n ->
let ints = List.init large ~f:(fun n ->
(string_of_int n, `Int n))
in
`Assoc ints

let large_int_list =
let ints = List.init large (fun n -> `Int n) in
let ints = List.init large ~f:(fun n -> `Int n) in
`List ints

let large_string_list =
let strings = List.init large (fun n ->
let strings = List.init large ~f:(fun n ->
`String (string_of_int n))
in
`List strings
Expand Down
2 changes: 2 additions & 0 deletions bench/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(executable
(name bench)
(package yojson-bench)
(public_name yojson-bench)
(flags (-safe-string))
(libraries yojson core_bench core))

Expand Down
1 change: 1 addition & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(test
(name test)
(package yojson)
(libraries yojson alcotest))
24 changes: 24 additions & 0 deletions yojson-bench.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
opam-version: "2.0"
maintainer: ["[email protected]" "[email protected]" "[email protected]"]
authors: ["Martin Jambon"]
homepage: "https://github.com/ocaml-community/yojson"
bug-reports: "https://github.com/ocaml-community/yojson/issues"
dev-repo: "git+https://github.com/ocaml-community/yojson.git"
doc: "https://ocaml-community.github.io/yojson/"
license: "BSD-3-Clause"
depends: [
"ocaml" {>= "4.04"}
"yojson" {= version}
"dune"
"core_bench" {>= "v0.11.0"}
"core" {>= "v0.11.0"}
]
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]
synopsis: "Run Yojson benchmarks"
description: """\
Yojson benchmarks require `Core_bench` which is not a dependency of Yojson,
because it is not part of the regular installation/testing flow. This is solely
meant for developers that are worried about performance changes in Yojson."""