]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/linked-assocs/linked-assocs.factor
core: Rename iota to <iota> so we can have TUPLE: iota ... ; instead of TUPLE: iota...
[factor.git] / extra / benchmark / linked-assocs / linked-assocs.factor
1 USING: assocs combinators fry kernel linked-assocs math
2 sequences ;
3
4 IN: benchmark.linked-assocs
5
6 : (linked-assocs-benchmark) ( -- )
7     10,000 <iota> <linked-hash> {
8         [ '[ 0 swap _ set-at ] each ]
9         [ '[ _ at ] map-sum 0 assert= ]
10         [ '[ dup _ set-at ] each ]
11         [ '[ _ at ] map-sum 49995000 assert= ]
12         [ '[ _ delete-at ] each ]
13         [ nip assoc-size 0 assert= ]
14     } 2cleave ;
15
16 : linked-assocs-benchmark ( -- )
17     100 [ (linked-assocs-benchmark) ] times ;
18
19 MAIN: linked-assocs-benchmark