ruby-changes:3308
From: ko1@a...
Date: 30 Dec 2007 23:20:52 +0900
Subject: [ruby-changes:3308] eban - Ruby:r14801 (trunk): * golf_prelude.rb (@@golf_hash): for performance improvement.
eban 2007-12-30 23:20:37 +0900 (Sun, 30 Dec 2007) New Revision: 14801 Modified files: trunk/ChangeLog trunk/golf_prelude.rb Log: * golf_prelude.rb (@@golf_hash): for performance improvement. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/golf_prelude.rb?r1=14801&r2=14800 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14801&r2=14800 Index: ChangeLog =================================================================== --- ChangeLog (revision 14800) +++ ChangeLog (revision 14801) @@ -1,3 +1,7 @@ +Sun Dec 30 23:19:06 2007 WATANABE Hirofumi <eban@r...> + + * golf_prelude.rb (@@golf_hash): for performance improvement. + Sun Dec 30 22:44:50 2007 Tadayoshi Funaba <tadf@d...> * lib/date.rb (_valid_time?): I'm not sure to recommend such an Index: golf_prelude.rb =================================================================== --- golf_prelude.rb (revision 14800) +++ golf_prelude.rb (revision 14801) @@ -1,9 +1,9 @@ SCRIPT_LINES__={} class Object + @@golf_hash = {} def method_missing m, *a, &b - r = /^#{m}/ - t = (methods + private_methods).sort.find{|e|r=~e} + t = @@golf_hash[[m,self.class]] ||= (methods + private_methods).sort.find{|e|/^#{m}/=~e} t ? __send__(t, *a, &b) : super end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml