rexml Encoding logic creates unnecessary singleton classes, aliases at runtime
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.
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.
Updated by headius (Charles Nutter) almost 10 years ago
Oops, I realized that also has my baseparser.rb patch. It can be ignored; there's a separate bug for that applied against ruby-trunk. I'd love to see that backported to 1.8.7, but it's not related to this bug.
Updated by kou (Kouhei Sutou) about 9 years ago
- Status changed from Open to Rejected
http://www.ruby-lang.org/en/news/2011/10/06/plans-for-1-8-7/ says "We continue to provide normal maintenance for 1.8.7 as usual, until June 2012. ... After that we stop bugfixes.". Now, "after June 2012" is true. So I close this.