Skip to content

Commit

Permalink
Merge pull request #117 from tmcgilchrist/tmcgilchrist/lint
Browse files Browse the repository at this point in the history
Add bench dependencies on core and core_bench.
  • Loading branch information
Leonidas-from-XIV authored Jan 24, 2022
2 parents 05d0a00 + 485ac8d commit ddada01
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
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."""

0 comments on commit ddada01

Please sign in to comment.