From ee0b1f4703492cd3d1889551e782882b6b081b46 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Tue, 22 Sep 2015 20:57:58 +0000 Subject: micro-opt of hash lookups found by drh --- generic/tclHash.c | 2 +- generic/tclObj.c | 11 +++++------ generic/tclVar.c | 11 +++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 90be511..1991aea 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -326,7 +326,7 @@ CreateHashEntry( continue; } #endif - if (compareKeysProc((void *) key, hPtr)) { + if (((void *) key == hPtr) || compareKeysProc((void *) key, hPtr)) { if (newPtr) { *newPtr = 0; } diff --git a/generic/tclObj.c b/generic/tclObj.c index f9216b3..15ea91f 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3971,12 +3971,11 @@ TclCompareObjKeys( /* * If the object pointers are the same then they match. - */ - - if (objPtr1 == objPtr2) { - return 1; - } - + * OPT: this comparison was moved to the caller + + if (objPtr1 == objPtr2) return 1; + */ + /* * Don't use Tcl_GetStringFromObj as it would prevent l1 and l2 being * in a register. diff --git a/generic/tclVar.c b/generic/tclVar.c index b37283b..f93de3b 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -6364,12 +6364,11 @@ CompareVarKeys( /* * If the object pointers are the same then they match. - */ - - if (objPtr1 == objPtr2) { - return 1; - } - + * OPT: this comparison was moved to the caller + + if (objPtr1 == objPtr2) return 1; + */ + /* * Don't use Tcl_GetStringFromObj as it would prevent l1 and l2 being in a * register. -- cgit v0.12