# HG changeset patch # User Claus Gittinger # Date 952711954 -3600 # Node ID f2d689cf7be4c9ee68c76c5ea865b987809c057d # Parent e329b1ad8fe9fb881ba292bee6f3b0395d4bf745 speedup #who (guess className from sourceFileName) diff -r e329b1ad8fe9 -r f2d689cf7be4 Method.st --- a/Method.st Fri Mar 03 16:40:11 2000 +0100 +++ b/Method.st Fri Mar 10 19:12:34 2000 +0100 @@ -2188,10 +2188,34 @@ Q2: if so, what about the bad guy then, who copies methods around to other classes ?" - |classes cls sel| + |classes cls sel fn clsName| " - very first, look in the class we found something the last time + speedup kludge: if my sourceFileName is valid, + extract the className from it and try that class first. + " + (fn := self sourceFilename) notNil ifTrue:[ + clsName := fn asFilename withoutSuffix name. + clsName := clsName asSymbolIfInterned. + clsName notNil ifTrue:[ + cls := Smalltalk at:clsName ifAbsent:nil. + cls notNil ifTrue:[ + sel := cls selectorAtMethod:self. + sel notNil ifTrue:[ + ^ MethodWhoInfo class:cls selector:sel + ]. + + cls := cls class. + sel := cls selectorAtMethod:self. + sel notNil ifTrue:[ + ^ MethodWhoInfo class:cls selector:sel + ]. + ] + ]. + ]. + + " + then, look in the class we found something the last time this may often give a hit, when asking who repeatingly for a context chain. (keep last by its name, to not keep classes from being garbage collected) @@ -2484,6 +2508,6 @@ !Method class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.184 2000-02-29 18:09:04 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.185 2000-03-10 18:12:34 cg Exp $' ! ! Method initialize!