benchmark.msgpack: adding msgpack benchmark.

db4
John Benediktsson 2013-11-25 10:43:42 -08:00
parent 39b7aa264e
commit 344e57a838
1 changed files with 15 additions and 0 deletions

View File

@ -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" <repetition> pack-sum-lengths 2,500,000 assert=
500,000 pi <repetition> pack-sum 0x1.7f7ec53a9f04ap20 assert= ;
MAIN: msgpack-benchmark