Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23253
Modified Files: Tag: devel_0_39 objective.tcl Log Message: method cache causes big speedup.
when loading tests/city.pd and pressing Ctrl+A Shift+Right and then typing "times" in the Tcl box (requires Tclx), i get times around 1.3 times shorter using this method cache.
Index: objective.tcl =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/objective.tcl,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -C2 -d -r1.1.2.14 -r1.1.2.15 *** objective.tcl 15 Aug 2006 19:47:31 -0000 1.1.2.14 --- objective.tcl 17 Aug 2006 07:40:24 -0000 1.1.2.15 *************** *** 87,91 **** # TODO: cache lookup for greater speed proc unknown {args} { ! global _ set self [lindex $args 0] if {"$self" == ""} {error "null pointer error"} --- 87,91 ---- # TODO: cache lookup for greater speed proc unknown {args} { ! global _ __ set self [lindex $args 0] if {"$self" == ""} {error "null pointer error"} *************** *** 96,103 **** set ancestors {} set selector [lindex $args 1] ! lookup_method $_($self:_class) $selector methods ancestors set i 0 - # puts "FOUND METHODS: $methods" if {![llength $methods]} { error "no such method '$selector' for object '$self'\nwith ancestors {$ancestors}" } --- 96,109 ---- set ancestors {} set selector [lindex $args 1] ! set class $_($self:_class) ! if {[info exists __($class:$selector)]} { ! set methods $__($class:$selector) ! } { ! lookup_method $_($self:_class) $selector methods ancestors ! set __($class:$selector) $methods ! } set i 0 if {![llength $methods]} { + set ancestors [Class_ancestors $class] error "no such method '$selector' for object '$self'\nwith ancestors {$ancestors}" }