Index: pjproject/trunk/pjlib/src/pj/hash.c
===================================================================
--- pjproject/trunk/pjlib/src/pj/hash.c	(revision 622)
+++ pjproject/trunk/pjlib/src/pj/hash.c	(revision 623)
@@ -205,6 +205,4 @@
 {
     pj_hash_entry *entry;
-
-    if (hval) *hval = 0;
     entry = *find_entry( NULL, ht, key, keylen, NULL, hval, NULL);
     return entry ? entry->value : NULL;
Index: pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw
===================================================================
--- pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw	(revision 622)
+++ pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw	(revision 623)
@@ -208,4 +208,34 @@
 ###############################################################################
 
+Project: "test_pjsip"="..\..\pjsip\build\test_pjsip.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name pjlib
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name pjlib_util
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name pjmedia
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name pjsip_core
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name pjsip_simple
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name pjsip_ua
+    End Project Dependency
+}}}
+
+###############################################################################
+
 Global:
 
Index: pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 622)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 623)
@@ -38,4 +38,11 @@
 #define TSX_TRACE_(expr)
 #endif
+
+/* When this macro is set, transaction will keep the hashed value
+ * so that future lookup (to unregister transaction) does not need
+ * to recalculate the hash again. It should gains a little bit of
+ * performance, so generally we'd want this.
+ */
+#define PRECALC_HASH
 
 
@@ -530,9 +537,11 @@
 
     /* Register the transaction to the hash table. */
-    //pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-    //		 tsx->transaction_key.slen, tsx->hashed_key, tsx);
-    PJ_TODO(USE_PRECALCULATED_HASHED_VALUE);
+#ifdef PRECALC_HASH
+    pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr,
+    		 tsx->transaction_key.slen, tsx->hashed_key, tsx);
+#else
     pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr,
     		 tsx->transaction_key.slen, 0, tsx);
+#endif
 
     /* Unlock mutex. */
@@ -555,9 +564,11 @@
 
     /* Register the transaction to the hash table. */
-    //pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-    //		 tsx->transaction_key.slen, tsx->hashed_key, NULL);
-    PJ_TODO(USE_PRECALCULATED_HASHED_VALUE);
+#ifdef PRECALC_HASH
     pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
-		 tsx->transaction_key.slen, 0, NULL);
+    		 tsx->transaction_key.slen, tsx->hashed_key, NULL);
+#else
+    pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr,
+    		 tsx->transaction_key.slen, 0, NULL);
+#endif
 
     TSX_TRACE_((THIS_FILE, 
@@ -1154,11 +1165,8 @@
 
     /* Calculate hashed key value. */
-    PJ_TODO(OPTIMIZE_TSX_BY_PRECALCULATING_HASHED_KEY_VALUE);
-    /*
-     blp: somehow this yields different hashed value!!
-
+#ifdef PRECALC_HASH
     tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr,
 				   tsx->transaction_key.slen);
-     */
+#endif
 
     PJ_LOG(6, (tsx->obj_name, "tsx_key=%.*s", tsx->transaction_key.slen,
@@ -1283,11 +1291,8 @@
 
     /* Calculate hashed key value. */
-    PJ_TODO(OPTIMIZE_TSX_BY_PRECALCULATING_HASHED_KEY_VALUE);
-    /*
-     blp: somehow this yields different hashed value!!
-
+#ifdef PRECALC_HASH
     tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr,
 				   tsx->transaction_key.slen);
-     */
+#endif
 
     /* Duplicate branch parameter for transaction. */
