From: "headius (Charles Nutter)" Date: 2012-10-15T04:35:30+09:00 Subject: [ruby-core:47979] [ruby-trunk - Bug #7161][Open] Perf fix: use symbols instead of strings for const/ivar access methods Issue #7161 has been reported by headius (Charles Nutter). ---------------------------------------- Bug #7161: Perf fix: use symbols instead of strings for const/ivar access methods https://bugs.ruby-lang.org/issues/7161 Author: headius (Charles Nutter) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: 2.0.0 From pull request: https://github.com/ruby/ruby/pull/195 Fixes a number of places where literal, non-dynamic strings are used as the first argument for constant and instance variable get, set, and defined? methods. This reduces object overhead in all cases. Notable fixes: * Setting @original_filename and @content_type in read_multipart (cgi/core.rb). This is called for every multipart read. * Setting @uri and @ref in DrbObject.new_with (drb/drb.rb). Called for every "with" instantiation of a DrbObject. * Setting BINDING_QUEUE in IRB::Workspace#initialize (irb/workspace.rb). Called for every new IRB workspace. * Getting @mon_mutex in ConditionVariable#wait (monitor.rb). Called for every #wait. This fix makes the method require zero object allocation (other than imposed by the runtime). The other fixes are rarely called, but fixed for consistency. make test-all passes the same with or without this patch. -- http://bugs.ruby-lang.org/