This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
20
unikernel/duniverse/angstrom/benchmarks/async_benchmark.ml
Normal file
20
unikernel/duniverse/angstrom/benchmarks/async_benchmark.ml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
open Async
|
||||
|
||||
let main parser () =
|
||||
let toss _ = Deferred.unit in
|
||||
let reader = Lazy.force Reader.stdin in
|
||||
let parser =
|
||||
match parser with
|
||||
| `Http -> Angstrom.(RFC2616.request >>| fun x -> `Http x)
|
||||
| `Json -> Angstrom.(RFC7159.json >>| fun x -> `Json x)
|
||||
in
|
||||
Angstrom_async.parse_many parser toss reader
|
||||
>>| function
|
||||
| Ok () -> ()
|
||||
| Error err -> failwith err
|
||||
;;
|
||||
|
||||
let () =
|
||||
let parser = Command.Arg_type.of_alist_exn ["http", `Http; "json", `Json] in
|
||||
Command.(async_spec ~summary:"async benchmark"
|
||||
Spec.(empty +> Param.(anon ("PARSER" %: parser))) main |> run)
|
||||
Loading…
Add table
Add a link
Reference in a new issue