moved futures into threads/ and updated oasis; added benchmark for Conv

This commit is contained in:
Simon Cruanes 2014-03-01 16:30:37 +01:00
parent 012447ef8b
commit 6718277501
10 changed files with 223 additions and 205 deletions

4
META
View file

@ -1,5 +1,5 @@
# OASIS_START # OASIS_START
# DO NOT EDIT (digest: 6c4b4efc4408717882c37d4e5ee32d91) # DO NOT EDIT (digest: 9f5c18246e625c62ccb7bf59b1670289)
version = "0.1" version = "0.1"
description = "A bunch of modules, including polymorphic containers." description = "A bunch of modules, including polymorphic containers."
requires = "unix" requires = "unix"
@ -11,7 +11,7 @@ exists_if = "containers.cma"
package "thread" ( package "thread" (
version = "0.1" version = "0.1"
description = "A bunch of modules, including polymorphic containers." description = "A bunch of modules, including polymorphic containers."
requires = "containers lwt" requires = "containers threads lwt"
archive(byte) = "containers_thread.cma" archive(byte) = "containers_thread.cma"
archive(byte, plugin) = "containers_thread.cma" archive(byte, plugin) = "containers_thread.cma"
archive(native) = "containers_thread.cmxa" archive(native) = "containers_thread.cmxa"

12
_oasis
View file

@ -44,14 +44,14 @@ Library "containers"
BuildDepends: unix BuildDepends: unix
Library "containers_thread" Library "containers_thread"
Path: . Path: threads/
Modules: Future Modules: Future
FindlibName: thread FindlibName: thread
FindlibParent: containers FindlibParent: containers
Build$: flag(thread) Build$: flag(thread)
Install$: flag(thread) Install$: flag(thread)
BuildDepends: containers,threads BuildDepends: containers,threads
XMETARequires: containers,lwt XMETARequires: containers,threads,lwt
Library "containers_lwt" Library "containers_lwt"
Path: . Path: .
@ -90,6 +90,14 @@ Executable benchs
MainIs: benchs.ml MainIs: benchs.ml
BuildDepends: containers,bench BuildDepends: containers,bench
Executable bench_conv
Path: tests/
Install: false
CompiledObject: native
Build$: flag(bench)
MainIs: bench_conv.ml
BuildDepends: containers,benchmark
Test all Test all
Command: $run_tests Command: $run_tests
TestTools: run_tests TestTools: run_tests

49
_tags
View file

@ -1,5 +1,5 @@
# OASIS_START # OASIS_START
# DO NOT EDIT (digest: 546f589c3cee93fdadf97d55440d02f8) # DO NOT EDIT (digest: dcba3d944e29e7f7be0fecd41665b91e)
# Ignore VCS directories, you can use the same kind of rule outside # Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains # OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process # useless stuff for the build process
@ -55,48 +55,57 @@
"automaton.cmx": for-pack(Containers) "automaton.cmx": for-pack(Containers)
"conv.cmx": for-pack(Containers) "conv.cmx": for-pack(Containers)
# Library containers_thread # Library containers_thread
"containers_thread.cmxs": use_containers_thread "threads/containers_thread.cmxs": use_containers_thread
<*.ml{,i}>: package(threads) <threads/*.ml{,i}>: use_containers
<threads/*.ml{,i}>: package(threads)
<threads/*.ml{,i}>: package(unix)
# Library containers_lwt # Library containers_lwt
"containers_lwt.cmxs": use_containers_lwt "containers_lwt.cmxs": use_containers_lwt
"behavior.cmx": for-pack(Containers_lwt) "behavior.cmx": for-pack(Containers_lwt)
"lwt_automaton.cmx": for-pack(Containers_lwt) "lwt_automaton.cmx": for-pack(Containers_lwt)
<*.ml{,i}>: use_containers
<*.ml{,i}>: package(lwt) <*.ml{,i}>: package(lwt)
<*.ml{,i}>: package(lwt.unix) <*.ml{,i}>: package(lwt.unix)
<*.ml{,i}>: package(unix) <*.ml{,i}>: package(unix)
<*.ml{,i}>: use_containers
# Library containers_cgi # Library containers_cgi
"cgi/containers_cgi.cmxs": use_containers_cgi "cgi/containers_cgi.cmxs": use_containers_cgi
<cgi/*.ml{,i}>: use_containers
<cgi/*.ml{,i}>: package(CamlGI) <cgi/*.ml{,i}>: package(CamlGI)
<cgi/*.ml{,i}>: package(unix) <cgi/*.ml{,i}>: package(unix)
<cgi/*.ml{,i}>: use_containers
# Executable benchs # Executable benchs
"tests/benchs.native": use_containers
"tests/benchs.native": package(bench) "tests/benchs.native": package(bench)
"tests/benchs.native": package(unix) "tests/benchs.native": package(unix)
"tests/benchs.native": use_containers
<tests/*.ml{,i}>: package(bench) <tests/*.ml{,i}>: package(bench)
# Executable bench_conv
"tests/bench_conv.native": use_containers
"tests/bench_conv.native": package(benchmark)
"tests/bench_conv.native": package(unix)
<tests/*.ml{,i}>: package(benchmark)
# Executable run_tests # Executable run_tests
"tests/run_tests.native": use_containers
"tests/run_tests.native": package(threads)
"tests/run_tests.native": package(oUnit)
"tests/run_tests.native": package(lwt) "tests/run_tests.native": package(lwt)
"tests/run_tests.native": package(lwt.unix) "tests/run_tests.native": package(lwt.unix)
"tests/run_tests.native": package(oUnit)
"tests/run_tests.native": package(threads)
"tests/run_tests.native": package(unix) "tests/run_tests.native": package(unix)
"tests/run_tests.native": use_containers <tests/*.ml{,i}>: use_containers
<tests/*.ml{,i}>: package(threads)
<tests/*.ml{,i}>: package(oUnit)
<tests/*.ml{,i}>: package(lwt) <tests/*.ml{,i}>: package(lwt)
<tests/*.ml{,i}>: package(lwt.unix) <tests/*.ml{,i}>: package(lwt.unix)
<tests/*.ml{,i}>: package(oUnit)
<tests/*.ml{,i}>: package(threads)
<tests/*.ml{,i}>: package(unix) <tests/*.ml{,i}>: package(unix)
<tests/*.ml{,i}>: use_containers
# Executable web_pwd # Executable web_pwd
"examples/cgi/web_pwd.byte": package(CamlGI)
"examples/cgi/web_pwd.byte": package(threads)
"examples/cgi/web_pwd.byte": package(unix)
"examples/cgi/web_pwd.byte": use_containers
"examples/cgi/web_pwd.byte": use_containers_cgi "examples/cgi/web_pwd.byte": use_containers_cgi
<examples/cgi/*.ml{,i}>: package(CamlGI) "examples/cgi/web_pwd.byte": use_containers
<examples/cgi/*.ml{,i}>: package(threads) "examples/cgi/web_pwd.byte": package(threads)
<examples/cgi/*.ml{,i}>: package(unix) "examples/cgi/web_pwd.byte": package(CamlGI)
<examples/cgi/*.ml{,i}>: use_containers "examples/cgi/web_pwd.byte": package(unix)
<examples/cgi/*.ml{,i}>: use_containers_cgi <examples/cgi/*.ml{,i}>: use_containers_cgi
<examples/cgi/*.ml{,i}>: use_containers
<examples/cgi/*.ml{,i}>: package(threads)
<examples/cgi/*.ml{,i}>: package(CamlGI)
<examples/cgi/*.ml{,i}>: package(unix)
# OASIS_STOP # OASIS_STOP
<tests/*.ml{,i}>: thread
<threads/*.ml{,i}>: thread

View file

@ -1,4 +0,0 @@
# OASIS_START
# DO NOT EDIT (digest: adff855173c9b92b5478129af7d39e03)
Future
# OASIS_STOP

View file

@ -1,5 +1,5 @@
(* OASIS_START *) (* OASIS_START *)
(* DO NOT EDIT (digest: c8b764a938cf7287206f86816566b0b5) *) (* DO NOT EDIT (digest: e5b7778fcec1af4e8956e90e19fccd18) *)
module OASISGettext = struct module OASISGettext = struct
(* # 22 "src/oasis/OASISGettext.ml" *) (* # 22 "src/oasis/OASISGettext.ml" *)
@ -204,7 +204,8 @@ module BaseEnvLight = struct
end end
let rec var_expand str env = let var_get name env =
let rec var_expand str =
let buff = let buff =
Buffer.create ((String.length str) * 2) Buffer.create ((String.length str) * 2)
in in
@ -212,7 +213,7 @@ module BaseEnvLight = struct
buff buff
(fun var -> (fun var ->
try try
var_expand (MapString.find var env) env var_expand (MapString.find var env)
with Not_found -> with Not_found ->
failwith failwith
(Printf.sprintf (Printf.sprintf
@ -221,10 +222,8 @@ module BaseEnvLight = struct
str)) str))
str; str;
Buffer.contents buff Buffer.contents buff
in
var_expand (MapString.find name env)
let var_get name env =
var_expand (MapString.find name env) env
let var_choose lst env = let var_choose lst env =
@ -234,7 +233,7 @@ module BaseEnvLight = struct
end end
# 237 "myocamlbuild.ml" # 236 "myocamlbuild.ml"
module MyOCamlbuildFindlib = struct module MyOCamlbuildFindlib = struct
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *) (* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
@ -307,22 +306,6 @@ module MyOCamlbuildFindlib = struct
let find_syntaxes () = ["camlp4o"; "camlp4r"] let find_syntaxes () = ["camlp4o"; "camlp4r"]
let well_known_syntax = [
"camlp4.quotations.o";
"camlp4.quotations.r";
"camlp4.exceptiontracer";
"camlp4.extend";
"camlp4.foldgenerator";
"camlp4.listcomprehension";
"camlp4.locationstripper";
"camlp4.macro";
"camlp4.mapgenerator";
"camlp4.metagenerator";
"camlp4.profiler";
"camlp4.tracer"
]
let dispatch = let dispatch =
function function
| Before_options -> | Before_options ->
@ -348,17 +331,13 @@ module MyOCamlbuildFindlib = struct
List.iter List.iter
begin fun pkg -> begin fun pkg ->
let base_args = [A"-package"; A pkg] in let base_args = [A"-package"; A pkg] in
(* TODO: consider how to really choose camlp4o or camlp4r. *)
let syn_args = [A"-syntax"; A "camlp4o"] in let syn_args = [A"-syntax"; A "camlp4o"] in
let args = let args =
(* Heuristic to identify syntax extensions: whether they end in (* Heuristic to identify syntax extensions: whether they end in
".syntax"; some might not. * ".syntax"; some might not *)
*) if Filename.check_suffix pkg "syntax"
if Filename.check_suffix pkg "syntax" || then syn_args @ base_args
List.mem pkg well_known_syntax then else base_args
syn_args @ base_args
else
base_args
in in
flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; flag ["ocaml"; "compile"; "pkg_"^pkg] & S args;
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
@ -389,11 +368,7 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]); flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]); flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"])
flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]);
| _ -> | _ ->
() ()
@ -552,14 +527,10 @@ module MyOCamlbuildBase = struct
(* Add flags *) (* Add flags *)
List.iter List.iter
(fun (tags, cond_specs) -> (fun (tags, cond_specs) ->
let spec = BaseEnvLight.var_choose cond_specs env in let spec =
let rec eval_specs = BaseEnvLight.var_choose cond_specs env
function
| S lst -> S (List.map eval_specs lst)
| A str -> A (BaseEnvLight.var_expand str env)
| spec -> spec
in in
flag tags & (eval_specs spec)) flag tags & spec)
t.flags t.flags
| _ -> | _ ->
() ()
@ -576,14 +547,14 @@ module MyOCamlbuildBase = struct
end end
# 579 "myocamlbuild.ml" # 550 "myocamlbuild.ml"
open Ocamlbuild_plugin;; open Ocamlbuild_plugin;;
let package_default = let package_default =
{ {
MyOCamlbuildBase.lib_ocaml = MyOCamlbuildBase.lib_ocaml =
[ [
("containers", [], []); ("containers", [], []);
("containers_thread", [], []); ("containers_thread", ["threads"], []);
("containers_lwt", [], []); ("containers_lwt", [], []);
("containers_cgi", ["cgi"], []) ("containers_cgi", ["cgi"], [])
]; ];
@ -595,6 +566,6 @@ let package_default =
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
# 599 "myocamlbuild.ml" # 570 "myocamlbuild.ml"
(* OASIS_STOP *) (* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;; Ocamlbuild_plugin.dispatch dispatch_default;;

211
setup.ml
View file

@ -1,9 +1,9 @@
(* setup.ml generated for the first time by OASIS v0.3.0 *) (* setup.ml generated for the first time by OASIS v0.3.0 *)
(* OASIS_START *) (* OASIS_START *)
(* DO NOT EDIT (digest: 269dc97805609b876f6d0e0b85780bd1) *) (* DO NOT EDIT (digest: 70d10cce7646b7db6e9097bd53a36898) *)
(* (*
Regenerated by OASIS v0.4.2 Regenerated by OASIS v0.4.0
Visit http://oasis.forge.ocamlcore.org for more information and Visit http://oasis.forge.ocamlcore.org for more information and
documentation about functions used in this file. documentation about functions used in this file.
*) *)
@ -52,7 +52,6 @@ module OASISContext = struct
type t = type t =
{ {
(* TODO: replace this by a proplist. *)
quiet: bool; quiet: bool;
info: bool; info: bool;
debug: bool; debug: bool;
@ -89,31 +88,19 @@ module OASISContext = struct
{!default with quiet = true} {!default with quiet = true}
let fspecs () = let args () =
(* TODO: don't act on default. *)
let ignore_plugins = ref false in
["-quiet", ["-quiet",
Arg.Unit (fun () -> default := {!default with quiet = true}), Arg.Unit (fun () -> default := {!default with quiet = true}),
s_ " Run quietly"; (s_ " Run quietly");
"-info", "-info",
Arg.Unit (fun () -> default := {!default with info = true}), Arg.Unit (fun () -> default := {!default with info = true}),
s_ " Display information message"; (s_ " Display information message");
"-debug", "-debug",
Arg.Unit (fun () -> default := {!default with debug = true}), Arg.Unit (fun () -> default := {!default with debug = true}),
s_ " Output debug message"; (s_ " Output debug message")]
"-ignore-plugins",
Arg.Set ignore_plugins,
s_ " Ignore plugin's field.";
"-C",
(* TODO: remove this chdir. *)
Arg.String (fun str -> Sys.chdir str),
s_ "dir Change directory before running."],
fun () -> {!default with ignore_plugins = !ignore_plugins}
end end
module OASISString = struct module OASISString = struct
@ -299,13 +286,6 @@ module OASISUtils = struct
Hashtbl.hash (String.lowercase s) Hashtbl.hash (String.lowercase s)
end) end)
module SetStringCsl =
Set.Make
(struct
type t = string
let compare = compare_csl
end)
let varname_of_string ?(hyphen='_') s = let varname_of_string ?(hyphen='_') s =
if String.length s = 0 then if String.length s = 0 then
@ -940,6 +920,7 @@ module OASISLicense = struct
| DEP5And of license_dep_5 list | DEP5And of license_dep_5 list
type t = type t =
| DEP5License of license_dep_5 | DEP5License of license_dep_5
| OtherLicense of string (* URL *) | OtherLicense of string (* URL *)
@ -1633,12 +1614,6 @@ module OASISFeatures = struct
create "section_object" beta create "section_object" beta
(fun () -> (fun () ->
s_ "Implement an object section.") s_ "Implement an object section.")
let dynrun_for_release =
create "dynrun_for_release" alpha
(fun () ->
s_ "Make '-setup-update dynamic' suitable for releasing project.")
end end
module OASISUnixPath = struct module OASISUnixPath = struct
@ -2782,7 +2757,7 @@ module OASISFileUtil = struct
end end
# 2785 "setup.ml" # 2760 "setup.ml"
module BaseEnvLight = struct module BaseEnvLight = struct
(* # 22 "src/base/BaseEnvLight.ml" *) (* # 22 "src/base/BaseEnvLight.ml" *)
@ -2857,7 +2832,8 @@ module BaseEnvLight = struct
end end
let rec var_expand str env = let var_get name env =
let rec var_expand str =
let buff = let buff =
Buffer.create ((String.length str) * 2) Buffer.create ((String.length str) * 2)
in in
@ -2865,7 +2841,7 @@ module BaseEnvLight = struct
buff buff
(fun var -> (fun var ->
try try
var_expand (MapString.find var env) env var_expand (MapString.find var env)
with Not_found -> with Not_found ->
failwith failwith
(Printf.sprintf (Printf.sprintf
@ -2874,10 +2850,8 @@ module BaseEnvLight = struct
str)) str))
str; str;
Buffer.contents buff Buffer.contents buff
in
var_expand (MapString.find name env)
let var_get name env =
var_expand (MapString.find name env) env
let var_choose lst env = let var_choose lst env =
@ -2887,15 +2861,15 @@ module BaseEnvLight = struct
end end
# 2890 "setup.ml" # 2864 "setup.ml"
module BaseContext = struct module BaseContext = struct
(* # 22 "src/base/BaseContext.ml" *) (* # 22 "src/base/BaseContext.ml" *)
(* TODO: get rid of this module. *)
open OASISContext open OASISContext
let args () = fst (fspecs ()) let args = args
let default = default let default = default
@ -5026,14 +5000,11 @@ module BaseSetup = struct
s_ " Don't try to update setup.ml, even if _oasis has changed.") s_ " Don't try to update setup.ml, even if _oasis has changed.")
let default_oasis_fn = "_oasis"
let update_setup_ml t = let update_setup_ml t =
let oasis_fn = let oasis_fn =
match t.oasis_fn with match t.oasis_fn with
| Some fn -> fn | Some fn -> fn
| None -> default_oasis_fn | None -> "_oasis"
in in
let oasis_exec = let oasis_exec =
match t.oasis_exec with match t.oasis_exec with
@ -5131,8 +5102,7 @@ module BaseSetup = struct
try try
match t.oasis_digest with match t.oasis_digest with
| Some dgst -> | Some dgst ->
if Sys.file_exists oasis_fn && if Sys.file_exists oasis_fn && dgst <> Digest.file "_oasis" then
dgst <> Digest.file default_oasis_fn then
begin begin
do_update (); do_update ();
true true
@ -5298,7 +5268,7 @@ module BaseSetup = struct
end end
# 5301 "setup.ml" # 5271 "setup.ml"
module InternalConfigurePlugin = struct module InternalConfigurePlugin = struct
(* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *) (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
@ -6147,7 +6117,7 @@ module InternalInstallPlugin = struct
end end
# 6150 "setup.ml" # 6120 "setup.ml"
module OCamlbuildCommon = struct module OCamlbuildCommon = struct
(* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *) (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
@ -6159,15 +6129,10 @@ module OCamlbuildCommon = struct
open OASISGettext open OASISGettext
open BaseEnv open BaseEnv
open BaseStandardVar open BaseStandardVar
open OASISTypes
let ocamlbuild_clean_ev =
"ocamlbuild-clean"
type extra_args = string list
let ocamlbuild_clean_ev = "ocamlbuild-clean"
let ocamlbuildflags = let ocamlbuildflags =
@ -6290,7 +6255,27 @@ module OCamlbuildPlugin = struct
ref (fun lst -> lst) ref (fun lst -> lst)
let build extra_args pkg argv = type ocamlbuild_plugin =
{
plugin_tags: string option;
extra_args: string list;
}
let check_ocaml_version version pkg =
match pkg.ocaml_version with
| Some ocaml_version ->
let min_ocaml_version = OASISVersion.version_of_string version in
OASISVersion.comparator_ge min_ocaml_version ocaml_version
| None ->
false
let ocamlbuild_supports_ocamlfind = check_ocaml_version "3.12.1"
let ocamlbuild_supports_plugin_tags = check_ocaml_version "4.01"
let build t pkg argv =
(* Return the filename in build directory *) (* Return the filename in build directory *)
let in_build_dir fn = let in_build_dir fn =
Filename.concat Filename.concat
@ -6434,13 +6419,33 @@ module OCamlbuildPlugin = struct
(BaseBuilt.register bt bnm lst) (BaseBuilt.register bt bnm lst)
in in
let cond_targets =
(* Run the hook *) (* Run the hook *)
let cond_targets = !cond_targets_hook cond_targets in !cond_targets_hook cond_targets
in
let extra_args =
match t.plugin_tags with
| Some tags -> "-plugin-tags" :: ("'" ^ tags ^ "'") :: t.extra_args
| None -> t.extra_args
in
let extra_args =
if ocamlbuild_supports_ocamlfind pkg then
"-use-ocamlfind" :: extra_args
else
extra_args
in
(* Run a list of target... *) (* Run a list of target... *)
run_ocamlbuild (List.flatten (List.map snd cond_targets) @ extra_args) argv; run_ocamlbuild
(List.flatten
(List.map snd cond_targets)
@ extra_args)
argv;
(* ... and register events *) (* ... and register events *)
List.iter check_and_register (List.flatten (List.map fst cond_targets)) List.iter
check_and_register
(List.flatten (List.map fst cond_targets))
let clean pkg extra_args = let clean pkg extra_args =
@ -6477,18 +6482,12 @@ module OCamlbuildDocPlugin = struct
type run_t =
{
extra_args: string list;
run_path: unix_filename;
}
let doc_build path pkg (cs, doc) argv =
let doc_build run pkg (cs, doc) argv =
let index_html = let index_html =
OASISUnixPath.make OASISUnixPath.make
[ [
run.run_path; path;
cs.cs_name^".docdir"; cs.cs_name^".docdir";
"index.html"; "index.html";
] ]
@ -6497,11 +6496,11 @@ module OCamlbuildDocPlugin = struct
OASISHostPath.make OASISHostPath.make
[ [
build_dir argv; build_dir argv;
OASISHostPath.of_unix run.run_path; OASISHostPath.of_unix path;
cs.cs_name^".docdir"; cs.cs_name^".docdir";
] ]
in in
run_ocamlbuild (index_html :: run.extra_args) argv; run_ocamlbuild [index_html] argv;
List.iter List.iter
(fun glb -> (fun glb ->
BaseBuilt.register BaseBuilt.register
@ -6512,7 +6511,7 @@ module OCamlbuildDocPlugin = struct
["*.html"; "*.css"] ["*.html"; "*.css"]
let doc_clean run pkg (cs, doc) argv = let doc_clean t pkg (cs, doc) argv =
run_clean argv; run_clean argv;
BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name
@ -6520,7 +6519,7 @@ module OCamlbuildDocPlugin = struct
end end
# 6523 "setup.ml" # 6522 "setup.ml"
module CustomPlugin = struct module CustomPlugin = struct
(* # 22 "src/plugins/custom/CustomPlugin.ml" *) (* # 22 "src/plugins/custom/CustomPlugin.ml" *)
@ -6668,13 +6667,15 @@ module CustomPlugin = struct
end end
# 6671 "setup.ml" # 6670 "setup.ml"
open OASISTypes;; open OASISTypes;;
let setup_t = let setup_t =
{ {
BaseSetup.configure = InternalConfigurePlugin.configure; BaseSetup.configure = InternalConfigurePlugin.configure;
build = OCamlbuildPlugin.build ["-use-ocamlfind"]; build =
OCamlbuildPlugin.build
{OCamlbuildPlugin.plugin_tags = None; extra_args = []};
test = test =
[ [
("all", ("all",
@ -6686,15 +6687,7 @@ let setup_t =
cmd_distclean = [(OASISExpr.EBool true, None)] cmd_distclean = [(OASISExpr.EBool true, None)]
}) })
]; ];
doc = doc = [("containers", OCamlbuildDocPlugin.doc_build ".")];
[
("containers",
OCamlbuildDocPlugin.doc_build
{
OCamlbuildDocPlugin.extra_args = ["-use-ocamlfind"];
run_path = "."
})
];
install = InternalInstallPlugin.install; install = InternalInstallPlugin.install;
uninstall = InternalInstallPlugin.uninstall; uninstall = InternalInstallPlugin.uninstall;
clean = [OCamlbuildPlugin.clean]; clean = [OCamlbuildPlugin.clean];
@ -6709,15 +6702,7 @@ let setup_t =
cmd_distclean = [(OASISExpr.EBool true, None)] cmd_distclean = [(OASISExpr.EBool true, None)]
}) })
]; ];
clean_doc = clean_doc = [("containers", OCamlbuildDocPlugin.doc_clean ".")];
[
("containers",
OCamlbuildDocPlugin.doc_clean
{
OCamlbuildDocPlugin.extra_args = ["-use-ocamlfind"];
run_path = "."
})
];
distclean = []; distclean = [];
distclean_test = distclean_test =
[ [
@ -6926,7 +6911,7 @@ let setup_t =
(OASISExpr.EBool true, false); (OASISExpr.EBool true, false);
(OASISExpr.EFlag "thread", true) (OASISExpr.EFlag "thread", true)
]; ];
bs_path = "."; bs_path = "threads/";
bs_compiled_object = Best; bs_compiled_object = Best;
bs_build_depends = bs_build_depends =
[ [
@ -7095,6 +7080,37 @@ let setup_t =
bs_nativeopt = [(OASISExpr.EBool true, [])] bs_nativeopt = [(OASISExpr.EBool true, [])]
}, },
{exec_custom = false; exec_main_is = "benchs.ml"}); {exec_custom = false; exec_main_is = "benchs.ml"});
Executable
({
cs_name = "bench_conv";
cs_data = PropList.Data.create ();
cs_plugin_data = []
},
{
bs_build =
[
(OASISExpr.EBool true, false);
(OASISExpr.EFlag "bench", true)
];
bs_install = [(OASISExpr.EBool true, false)];
bs_path = "tests/";
bs_compiled_object = Native;
bs_build_depends =
[
InternalLibrary "containers";
FindlibPackage ("benchmark", None)
];
bs_build_tools = [ExternalTool "ocamlbuild"];
bs_c_sources = [];
bs_data_files = [];
bs_ccopt = [(OASISExpr.EBool true, [])];
bs_cclib = [(OASISExpr.EBool true, [])];
bs_dlllib = [(OASISExpr.EBool true, [])];
bs_dllpath = [(OASISExpr.EBool true, [])];
bs_byteopt = [(OASISExpr.EBool true, [])];
bs_nativeopt = [(OASISExpr.EBool true, [])]
},
{exec_custom = false; exec_main_is = "bench_conv.ml"});
Executable Executable
({ ({
cs_name = "run_tests"; cs_name = "run_tests";
@ -7223,9 +7239,8 @@ let setup_t =
plugin_data = [] plugin_data = []
}; };
oasis_fn = Some "_oasis"; oasis_fn = Some "_oasis";
oasis_version = "0.4.2"; oasis_version = "0.4.0";
oasis_digest = oasis_digest = Some "r\230rE\018\166\247N\216N\001k\0214\177\204";
Some "\145G\\+\192\166\200\007\233\210\000\157\216\241\017 ";
oasis_exec = None; oasis_exec = None;
oasis_setup_args = []; oasis_setup_args = [];
setup_update = false setup_update = false
@ -7233,6 +7248,6 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;; let setup () = BaseSetup.setup setup_t;;
# 7237 "setup.ml" # 7252 "setup.ml"
(* OASIS_STOP *) (* OASIS_STOP *)
let () = setup ();; let () = setup ();;

19
tests/bench_conv.ml Normal file
View file

@ -0,0 +1,19 @@
let conv_json =
let src = Conv.Source.(list_ (pair int_ int_)) in
fun x -> Conv.into src Conv.Json.sink x
let manual_json =
fun l ->
`List (List.map (fun (a,b) -> `List [`Int a; `Int b]) l)
let bench_list x =
let res = Benchmark.throughputN 5
[ "conv", conv_json, x
; "manual", manual_json, x
] in
Benchmark.tabulate res
let () =
Printf.printf "list of 5 elements...\n";
bench_list [1,2; 3,4; 5,6; 7,8; 9,10]