Invalidate constant cache if included module has constants#795
Conversation
There was a problem hiding this comment.
Oops you're right. Good catch!
…-included-module-has-constants Invalidate constant cache if included module has constants
|
Good find, thanks! Some day we'll have to (re)explore a non-global way to invalidate constant caches. |
|
@headius I've got branches for Rubinius and MRI implementing constant name cache invalidation. I'd be willing to work towards implementing something similar in JRuby. |
|
We can talk about your strategy, certainly. Is there something I can look at online? I am guessing it is still global, but tries to reduce cache thrashing by splitting it up by constant name? |
|
Yep pretty much. Here's the diff of the Rubinius implementation: haileys/rubinius@master...constant-name-serial On 09/06/2013, at 3:16, Charles Oliver Nutter notifications@github.com wrote:
|
|
Yeah, simple enough...if you'd like to attempt a version for JRuby, it shouldn't be any more difficult than for Rubinius. I still wish it didn't have to be global invalidation, but this is an improvement. |
JRuby currently does not invalidate the global constant cache serial number if an included module has constants.
This means that cached constant lookups could return incorrect results.
Here's a little test script demonstrating the incorrect behaviour: