1 USING: assocs combinators kernel linked-assocs math sequences ;
3 IN: benchmark.linked-assocs
5 : (linked-assocs-benchmark) ( -- )
6 10,000 <iota> <linked-hash> {
7 [ '[ 0 swap _ set-at ] each ]
8 [ '[ _ at ] map-sum 0 assert= ]
9 [ '[ dup _ set-at ] each ]
10 [ '[ _ at ] map-sum 49995000 assert= ]
11 [ '[ _ delete-at ] each ]
12 [ nip assoc-size 0 assert= ]
15 : linked-assocs-benchmark ( -- )
16 100 [ (linked-assocs-benchmark) ] times ;
18 MAIN: linked-assocs-benchmark