Project

General

Profile

Actions

Feature #17763

closed

Implement cache for cvars

Feature #17763: Implement cache for cvars

Added by eileencodes (Eileen Uchitelle) over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:103105]

Description

Introduce inline cache for class variable reads

@tenderlove and I would like to introduce an inline cache for class variable reads. We've attached a patch that introduces the cache. Class variable reads are popular in Rails applications for example, Active Record's #logger.

GitHub PR: https://github.com/ruby/ruby/pull/4340

Cache Design

This patch introduces a hash table that's stored on the same class as the class variable value.

For example:

class A
  @@foo = 1
end

class