[#61424] [REJECT?] xmalloc/xfree: reduce atomic ops w/ thread-locals — Eric Wong <normalperson@...>

I'm unsure about this. I _hate_ the extra branches this adds;

13 messages 2014/03/12

[ruby-core:61216] [ruby-trunk - Bug #9262] global_method_cache should be configurable or grow automatically

From: normalperson@...
Date: 2014-03-02 03:29:07 UTC
List: ruby-core #61216
Issue #9262 has been updated by Eric Wong.


 normalperson@yhbt.net wrote:
 >  http://bogomips.org/ruby.git/patch/?id=a899e54e6abc13b8816e6c5f69ff560918db4be1
 
 Btw, I'd like to commit just the vm_method.c change for this
 to avoid writing to method cache if disabled.
 
 It also replaces CPP #if with C if for readability.
 
 Ugh, commit message was long, just the vm_method.c change:
 http://bogomips.org/ruby.git/diff/vm_method.c?id=a899e54e6abc1

----------------------------------------
Bug #9262: global_method_cache should be configurable or grow automatically
https://bugs.ruby-lang.org/issues/9262#change-45567

* Author: Aman Gupta
* Status: Open
* Priority: Normal
* Assignee: Koichi Sasada
* Category: 
* Target version: next minor
* ruby -v: -
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN
----------------------------------------
The global_method_cache is currently a fixed 2048 entries. This is not configurable, and can be inadequate for large applications with thousands of classes and methods.

In our app, increasing the size of the cache to 32768 entries reduced time spent in search_method and overall pressure on st_lookup:

before
      420  14.0% st_lookup
      182   6.1% vm_search_method (inline)

after
      265   9.5% st_lookup
      125   4.5% vm_search_method (inline)

It's possible the VM could grow global_method_cache automatically, using some heuristic based on the number of long-lived classes or method_entries that are defined.
However this would break the hashing in the current implementation.



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

In This Thread