2013-03-07 12:58:16 -05:00
|
|
|
USING: assocs combinators fry kernel linked-assocs math
|
|
|
|
sequences ;
|
|
|
|
|
2016-06-20 19:43:46 -04:00
|
|
|
IN: benchmark.linked-assocs
|
2013-03-07 12:58:16 -05:00
|
|
|
|
|
|
|
: (linked-assocs-benchmark) ( -- )
|
|
|
|
10,000 iota <linked-hash> {
|
2016-06-25 15:04:03 -04:00
|
|
|
[ $[ 0 swap _ set-at ] each ]
|
|
|
|
[ $[ _ at ] map-sum 0 assert= ]
|
|
|
|
[ $[ dup _ set-at ] each ]
|
|
|
|
[ $[ _ at ] map-sum 49995000 assert= ]
|
|
|
|
[ $[ _ delete-at ] each ]
|
2013-03-07 12:58:16 -05:00
|
|
|
[ nip assoc-size 0 assert= ]
|
|
|
|
} 2cleave ;
|
|
|
|
|
|
|
|
: linked-assocs-benchmark ( -- )
|
|
|
|
100 [ (linked-assocs-benchmark) ] times ;
|
|
|
|
|
2016-06-21 15:03:32 -04:00
|
|
|
MAIN: linked-assocs-benchmark
|