]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/msgpack/msgpack.factor
core: Rename iota to <iota> so we can have TUPLE: iota ... ; instead of TUPLE: iota...
[factor.git] / extra / benchmark / msgpack / msgpack.factor
1 USING: kernel math math.constants msgpack sequences ;
2 IN: benchmark.msgpack
3
4 : pack-sum ( seq -- n )
5     [ >msgpack msgpack> ] map-sum ;
6
7 : pack-sum-lengths ( seq -- n )
8     [ >msgpack msgpack> length ] map-sum ;
9
10 : msgpack-benchmark ( -- )
11     500,000 <iota> pack-sum 124,999,750,000 assert=
12     500,000 "hello" <repetition> pack-sum-lengths 2,500,000 assert=
13     500,000 pi <repetition> pack-sum 0x1.7f7ec53a9f04ap20 assert= ;
14
15 MAIN: msgpack-benchmark