3 : bucket
-count
( -- bkcount
) 1 wlist
-hash
-bits lshift
;
8 bucket
-count cells buffer
: bucket
-items
10 : count
-bucket
-items
( bkptr
-- )
19 : setup
-word
-count
( vocid
-- )
21 [: drop word
-count
1+! false
;] foreach
-word drop
24 : setup
-buckets
-info
( vocid
-- )
25 vocid
->htable
to buckets
26 bucket
-items bucket
-count cells erase
28 i cells buckets
+ count
-bucket
-items
29 i cells bucket
-items
+ !
33 : voc
-setup
( vocid
-- )
35 vocid setup
-word
-count
36 vocid setup
-buckets
-info
40 : has
-bucket
-with?
( count
-- flag
)
42 i cells bucket
-items
+ @ over
= if drop true unloop exit
endif
49 bucket
-count
0 do i cells bucket
-items
+ @ max loop
55 i cells bucket
-items
+ @ j
= if i
. endif
63 : show
-stats
( vocid
-- )
68 ." -- " word
-count @
. ." words, "
70 0 0x7fff_ffff \ max and min in bucket
73 i cells bucket
-items
+ @
76 1+ \ update total used
83 ;; ( bkmin bkmax bkused
)
84 nrot
2dup
2>r rot \
for average
85 0 .r
." /" bucket
-count
. ." buckets, " . ." min, " . ." max, average per bucket: "
89 show
-details?
if show
-details
endif
93 : ?show
-stats
( addr count
-- )
95 voc
-cfa
->vocid show
-stats
99 cli-arg-next argv-str s" --details" s=ci to show-details?
102 s
" forth" ?show
-stats
103 s
" disx86" ?show
-stats
104 s
" asmx86" ?show
-stats
105 s
" asmx86:lexer" ?show
-stats
106 s
" asmx86:instructions" ?show
-stats
107 s
" asm-labman" ?show
-stats
108 s
" asm-meta" ?show
-stats