summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2011-12-06 21:33:47 -0800
committerNiko Matsakis <niko@alum.mit.edu>2011-12-07 17:05:58 -0800
commit30a2361e6848827036edae21fec795b958cc1b9d (patch)
treef9cebd8b62428705ada33fa8867e22edfd203106 /src/libstd
parent13a3288f3f88b66fec97e253327bf349359c6db1 (diff)
downloadrust-30a2361e6848827036edae21fec795b958cc1b9d.tar.gz
rust-30a2361e6848827036edae21fec795b958cc1b9d.zip
add some debugging logs
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/map.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index bacbca37a47..1f34a682449 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -133,16 +133,24 @@ mod chained {
     fn search_rem<copy K, copy V>(tbl: t<K,V>,
                                   k: K,
                                   h: uint,
+                                  idx: uint,
                                   e_root: @entry<K,V>) -> search_result<K,V> {
         let e0 = e_root;
+        let comp = 1u;   // for logging
         while true {
             alt e0.next {
               absent. {
+                log("search_tbl", "absent", "comparisons", comp,
+                    "hash", h, "idx", idx);
+
                 ret not_found;
               }
               present(e1) {
+                comp += 1u;
                 let e1_key = e1.key; // Satisfy alias checker.
                 if e1.hash == h && tbl.eqer(e1_key, k) {
+                    log("search_tbl", "present", "comparisons", comp,
+                        "hash", h, "idx", idx);
                     ret found_after(e0, e1);
                 } else {
                     e0 = e1;
@@ -158,14 +166,18 @@ mod chained {
         let idx = h % vec::len(tbl.chains);
         alt tbl.chains[idx] {
           absent. {
+            log("search_tbl", "absent", "comparisons", 0u,
+                "hash", h, "idx", idx);
             ret not_found;
           }
           present(e) {
             let e_key = e.key; // Satisfy alias checker.
             if e.hash == h && tbl.eqer(e_key, k) {
+                log("search_tbl", "present", "comparisons", 1u,
+                    "hash", h, "idx", idx);
                 ret found_first(idx, e);
             } else {
-                ret search_rem(tbl, k, h, e);
+                ret search_rem(tbl, k, h, idx, e);
             }
           }
         }