Use symbols instead of strings for {const_,instance_variable_}{get,set}. #195

wants to merge 1 commit into


None yet

2 participants

headius commented Oct 12, 2012

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.

@headius headius added a commit to jruby/ruby that referenced this pull request Oct 24, 2012
@headius headius Use JSE properties for proxy defaults (JRuby GH #195) a4ecbbb

Committed as r37688.

Thanks for the PR.

@marcandre marcandre closed this Nov 16, 2012

I'm sorry, I should have added 'patch by Charles Nutter' to the commit log but I forgot that although git can track authors, svn does not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment