Skip to content

Commit 28409a7

Browse files
committed
---
yaml --- r: 6624 b: refs/heads/master c: 30a2361 h: refs/heads/master v: v3
1 parent ac6957c commit 28409a7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 13a3288f3f88b66fec97e253327bf349359c6db1
2+
refs/heads/master: 30a2361e6848827036edae21fec795b958cc1b9d

trunk/src/libstd/map.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,24 @@ mod chained {
133133
fn search_rem<copy K, copy V>(tbl: t<K,V>,
134134
k: K,
135135
h: uint,
136+
idx: uint,
136137
e_root: @entry<K,V>) -> search_result<K,V> {
137138
let e0 = e_root;
139+
let comp = 1u; // for logging
138140
while true {
139141
alt e0.next {
140142
absent. {
143+
log("search_tbl", "absent", "comparisons", comp,
144+
"hash", h, "idx", idx);
145+
141146
ret not_found;
142147
}
143148
present(e1) {
149+
comp += 1u;
144150
let e1_key = e1.key; // Satisfy alias checker.
145151
if e1.hash == h && tbl.eqer(e1_key, k) {
152+
log("search_tbl", "present", "comparisons", comp,
153+
"hash", h, "idx", idx);
146154
ret found_after(e0, e1);
147155
} else {
148156
e0 = e1;
@@ -158,14 +166,18 @@ mod chained {
158166
let idx = h % vec::len(tbl.chains);
159167
alt tbl.chains[idx] {
160168
absent. {
169+
log("search_tbl", "absent", "comparisons", 0u,
170+
"hash", h, "idx", idx);
161171
ret not_found;
162172
}
163173
present(e) {
164174
let e_key = e.key; // Satisfy alias checker.
165175
if e.hash == h && tbl.eqer(e_key, k) {
176+
log("search_tbl", "present", "comparisons", 1u,
177+
"hash", h, "idx", idx);
166178
ret found_first(idx, e);
167179
} else {
168-
ret search_rem(tbl, k, h, e);
180+
ret search_rem(tbl, k, h, idx, e);
169181
}
170182
}
171183
}

0 commit comments

Comments
 (0)