This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
18
unikernel/duniverse/angstrom/benchmarks/lwt_benchmark.ml
Normal file
18
unikernel/duniverse/angstrom/benchmarks/lwt_benchmark.ml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
open Lwt
|
||||
|
||||
let main () =
|
||||
let toss _ = Lwt.return_unit in
|
||||
let parser =
|
||||
match Sys.argv.(1) with
|
||||
| "http" -> Angstrom.(RFC2616.request >>| fun x -> `Http x)
|
||||
| "json" -> Angstrom.(RFC7159.json >>| fun x -> `Json x)
|
||||
| _ -> print_endline "usage: lwt_json_benchmark.native PARSER"; exit 1
|
||||
in
|
||||
Lwt_io.resize_buffer Lwt_io.stdin 0x10000 >>= fun () ->
|
||||
Angstrom_lwt_unix.parse_many parser toss Lwt_io.stdin
|
||||
>|= function
|
||||
| _, Ok () -> ()
|
||||
| _, Error err -> failwith err
|
||||
;;
|
||||
|
||||
Lwt_main.run (main ())
|
||||
Loading…
Add table
Add a link
Reference in a new issue