]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/linked-assocs/linked-assocs.factor
factor: trim using lists
[factor.git] / extra / benchmark / linked-assocs / linked-assocs.factor
1 USING: assocs combinators kernel linked-assocs math sequences ;
2
3 IN: benchmark.linked-assocs
4
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= ]
13     } 2cleave ;
14
15 : linked-assocs-benchmark ( -- )
16     100 [ (linked-assocs-benchmark) ] times ;
17
18 MAIN: linked-assocs-benchmark