Issue #5698 has been reported by Charles Nutter.

----------------------------------------
Bug #5698: rexml Encoding logic creates unnecessary singleton classes, aliases at runtime
http://redmine.ruby-lang.org/issues/5698

Author: Charles Nutter
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: Ruby 1.8.7
ruby -v: 1.8.7 head


The logic for switching a given parser to a new encoding currently does the following:

* Reopens the Encoding module (only on first use of the encoding)
* Defines two new methods for the encoding being applied (only on first use)
* Singletonizes the parser object and aliases the encoding-specific methods to "encode" and "decode"

This last phase is unnecessary, but happens at runtime whenever an encoding is applied to a parser. The resulting singletonizing and method aliasing causes cache flushes.

I have created a patch that does not use this singleton logic and which will not cause any singletons or method table updates at steady-state.

https://gist.github.com/1420708

I know 1.8.7 is only in security patch mode, but I thought I'd throw this out there. JRuby will probably apply it to our fork of 1.8.7 stdlib.


-- 
http://redmine.ruby-lang.org