[#41916] Proposal: Bitmap Marking GC — Narihiro Nakamura <authornari@...>

Hi.

18 messages 2012/01/05

[#41941] [ruby-trunk - Bug #5851][Open] make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame *** — Vit Ondruch <v.ondruch@...>

12 messages 2012/01/06

[#41979] [ruby-trunk - Bug #5865][Open] Exception#== should return false if the classes differ — Hiro Asari <asari.ruby@...>

10 messages 2012/01/08

[#42003] [ruby-trunk - Bug #5871][Open] regexp \W matches some word characters when inside a case-insensitive character class — Gareth Adams <gareth@...>

14 messages 2012/01/09

[#42016] [ruby-trunk - Feature #5873][Open] Adopt FFI over DL — Heesob Park <phasis@...>

15 messages 2012/01/10

[#42149] [ruby-trunk - Feature #5899][Open] chaining comparsions. — Ondrej Bilka <neleai@...>

12 messages 2012/01/16

[#42164] [ruby-trunk - Feature #5903][Open] Optimize st_table (take 2) — Yura Sokolov <funny.falcon@...>

18 messages 2012/01/17

[ruby-core:41894] [Backport93 - Backport #5835] Please Backport r34202 and r34204 (rexml BaseParser uses instance_eval unnecessarily on listener add)

From: Ayumu AIZAWA <ayumu.aizawa@...>
Date: 2012-01-03 16:28:25 UTC
List: ruby-core #41894
Issue #5835 has been updated by Ayumu AIZAWA.

File backport_5835.patch added
% Done changed from 100 to 0


----------------------------------------
Backport #5835: Please Backport r34202 and r34204 (rexml BaseParser uses instance_eval unnecessarily on listener add)
https://bugs.ruby-lang.org/issues/5835

Author: Charles Nutter
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


In add_listener in REXML::BaseParser, there's code to instance eval and replace the old "pull" method with a new one that calls all listeners. I assume this was done to avoid the cost of calling .each on the listeners when there's none registered, but when the list is empty this call is nearly a no-op anyway. The singletonizing effect of instance_eval and the redefinition of #pull, on the other hand, cause a cache flush throughout the system.

I have created a patch that removes the instance_eval, initializes the listeners array unconditionally, and does the event #each unconditionally. It passes all tests, and should perform better because it's not damaging the cache.

https://gist.github.com/1420383

This can be safely backported to any Ruby version and has no visible behavior change.


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

In This Thread

Prev Next