@@ -133,16 +133,24 @@ mod chained {
133
133
fn search_rem < copy K , copy V > ( tbl : t < K , V > ,
134
134
k : K ,
135
135
h : uint ,
136
+ idx : uint ,
136
137
e_root : @entry < K , V > ) -> search_result < K , V > {
137
138
let e0 = e_root;
139
+ let comp = 1 u; // for logging
138
140
while true {
139
141
alt e0. next {
140
142
absent. {
143
+ log ( "search_tbl" , "absent" , "comparisons" , comp,
144
+ "hash" , h, "idx" , idx) ;
145
+
141
146
ret not_found;
142
147
}
143
148
present ( e1) {
149
+ comp += 1 u;
144
150
let e1_key = e1. key ; // Satisfy alias checker.
145
151
if e1. hash == h && tbl. eqer ( e1_key, k) {
152
+ log ( "search_tbl" , "present" , "comparisons" , comp,
153
+ "hash" , h, "idx" , idx) ;
146
154
ret found_after ( e0, e1) ;
147
155
} else {
148
156
e0 = e1;
@@ -158,14 +166,18 @@ mod chained {
158
166
let idx = h % vec:: len ( tbl. chains ) ;
159
167
alt tbl. chains [ idx] {
160
168
absent. {
169
+ log ( "search_tbl" , "absent" , "comparisons" , 0 u,
170
+ "hash" , h, "idx" , idx) ;
161
171
ret not_found;
162
172
}
163
173
present ( e) {
164
174
let e_key = e. key ; // Satisfy alias checker.
165
175
if e. hash == h && tbl. eqer ( e_key, k) {
176
+ log ( "search_tbl" , "present" , "comparisons" , 1 u,
177
+ "hash" , h, "idx" , idx) ;
166
178
ret found_first ( idx, e) ;
167
179
} else {
168
- ret search_rem ( tbl, k, h, e) ;
180
+ ret search_rem ( tbl, k, h, idx , e) ;
169
181
}
170
182
}
171
183
}
0 commit comments