Skip to content

Commit

Permalink
Add -r flag to bench (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
3Rafal authored Dec 15, 2023
1 parent 1643fb7 commit 6b9463c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
15 changes: 7 additions & 8 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let man =
dumped into json-line files.";
]

let analyze ~backend (`Repeats repeats) (`Cache cache_workflow)
let analyze ~backend (`Cache cache_workflow) (`Repeats repeats)
(`Merlin merlin_path) (`Proj_dirs proj_dirs) (`Dir_name data_dir)
(`Sample_size sample_size) (`Query_types query_types)
(`Extensions extensions) =
Expand All @@ -35,7 +35,7 @@ let performance_term =
in
Term.(
const (analyze ~backend)
$ Args.repeats_per_sample $ Args.cache_workflow $ Args.merlin
$ Args.cache_workflow $ Args.repeats_per_sample $ Args.merlin
$ Args.proj_dirs $ Args.dir_name $ Args.sample_size $ Args.query_types
$ Args.extensions)

Expand All @@ -58,8 +58,8 @@ let behavior =
}
in
let backend = Merl_an.Backend.behavior config in
analyze ~backend (`Repeats 1)
(`Cache Merl_an.Merlin.Cache_workflow.Buffer_typed)
analyze ~backend (`Cache Merl_an.Merlin.Cache_workflow.Buffer_typed)
(`Repeats 1)
in
let pre_term = Term.(const f $ Args.no_full $ Args.no_distilled_data) in
let behavior_term =
Expand Down Expand Up @@ -87,10 +87,9 @@ let benchmark =
let regression_term =
Term.(
const
(analyze ~backend (`Repeats 1)
(`Cache Merl_an.Merlin.Cache_workflow.Buffer_typed))
$ Args.merlin $ Args.proj_dirs $ Args.dir_name $ Args.sample_size
$ Args.query_types $ Args.extensions)
(analyze ~backend (`Cache Merl_an.Merlin.Cache_workflow.Buffer_typed))
$ Args.repeats_per_sample $ Args.merlin $ Args.proj_dirs $ Args.dir_name
$ Args.sample_size $ Args.query_types $ Args.extensions)
in
let info =
let doc = "TODO" in
Expand Down
4 changes: 2 additions & 2 deletions lib/backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ module Benchmark = struct

let update_analysis_data ~id ~responses ~cmd ~file:_file
~loc:(_loc : Import.location) ~query_type tables =
let max_timing, _timings, responses =
let _max_timing, timings, responses =
(* FIXME: add json struture to the two lists *)
let rec loop ~max_timing ~responses ~timings = function
| [] -> (max_timing, timings, responses)
Expand All @@ -515,7 +515,7 @@ module Benchmark = struct
let metric =
{
Benchmark_metric.name = Merlin.Query_type.to_string query_type;
value = [ max_timing ];
value = timings;
units = "ms";
}
in
Expand Down
24 changes: 23 additions & 1 deletion test/bench.t/run.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$ merl-an benchmark -s 2 -p bench.ml,bench1.ml --data=test-data
$ merl-an benchmark -r 2 -s 2 -p bench.ml,bench1.ml --data=test-data

$ jq '.results |= map( .metrics |= map(.value |= map(0)))' test-data/bench.json
{
Expand All @@ -9,6 +9,10 @@
{
"name": "case-analysis",
"value": [
0,
0,
0,
0,
0,
0,
0,
Expand All @@ -19,6 +23,9 @@
{
"name": "complete-prefix",
"value": [
0,
0,
0,
0,
0,
0
Expand All @@ -28,6 +35,8 @@
{
"name": "errors",
"value": [
0,
0,
0,
0
],
Expand All @@ -36,6 +45,9 @@
{
"name": "expand-prefix",
"value": [
0,
0,
0,
0,
0,
0
Expand All @@ -45,6 +57,9 @@
{
"name": "locate",
"value": [
0,
0,
0,
0,
0,
0
Expand All @@ -54,6 +69,9 @@
{
"name": "occurrences",
"value": [
0,
0,
0,
0,
0,
0
Expand All @@ -63,6 +81,10 @@
{
"name": "type-enclosing",
"value": [
0,
0,
0,
0,
0,
0,
0,
Expand Down

0 comments on commit 6b9463c

Please sign in to comment.