From 344e57a838b4f505ddf54e3c2011153975c2b748 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 25 Nov 2013 10:43:42 -0800 Subject: [PATCH] benchmark.msgpack: adding msgpack benchmark. --- extra/benchmark/msgpack/msgpack.factor | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 extra/benchmark/msgpack/msgpack.factor diff --git a/extra/benchmark/msgpack/msgpack.factor b/extra/benchmark/msgpack/msgpack.factor new file mode 100644 index 0000000000..b0b82c9d6d --- /dev/null +++ b/extra/benchmark/msgpack/msgpack.factor @@ -0,0 +1,15 @@ +USING: kernel math math.constants msgpack sequences ; +IN: benchmark.msgpack + +: pack-sum ( seq -- n ) + 0 [ >msgpack msgpack> + ] reduce ; + +: pack-sum-lengths ( seq -- n ) + 0 [ >msgpack msgpack> length + ] reduce ; + +: msgpack-benchmark ( -- ) + 500,000 iota pack-sum 124,999,750,000 assert= + 500,000 "hello" pack-sum-lengths 2,500,000 assert= + 500,000 pi pack-sum 0x1.7f7ec53a9f04ap20 assert= ; + +MAIN: msgpack-benchmark