Project

General

Profile

Actions

Bug #9262

closed

global_method_cache should be configurable or grow automatically

Added by tmm1 (Aman Karmani) about 11 years ago. Updated almost 8 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:59198]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0