Project

General

Profile

Feature #9963

Symbol.count

Added by davidcornu (David Cornu) about 6 years ago. Updated about 6 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:63257]

Description

I'd like to add a way to get the size of Ruby's symbol table. This is currently possible by using Symbol.all_symbols, however it builds a new array every time it's invoked which is pretty inefficient.

The main use case for this would be to assist in detecting accidental symbol creation.

I have a PR open (https://github.com/ruby/ruby/pull/639) that adds a Symbol.count method but this could also be added in the output of GC.stat.


Related issues

Related to Ruby master - Feature #11158: Introduce a Symbol.count API as a more efficient alternative to Symbol.all_symbols.sizeClosedko1 (Koichi Sasada)Actions

Also available in: Atom PDF