Project

General

Profile

Actions

Feature #9963

closed

Symbol.count

Added by davidcornu (David Cornu) over 10 years ago. Updated over 10 years ago.

Status:
Feedback
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 1 (0 open1 closed)

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

Updated by kosaki (Motohiro KOSAKI) over 10 years ago

I understand symbol table detection is important for tuning ruby nowadays. But as far as I know, it is just because past ruby can't gc symbols.

Now, ruby trunk has symbol GC. (https://bugs.ruby-lang.org/issues/9634).
So, symbol table size is no longer important tuning parameter.

If you have another use case, please elaborate more detail.

Updated by davidcornu (David Cornu) over 10 years ago

Now, ruby trunk has symbol GC

Fantastic!

Updated by hsbt (Hiroshi SHIBATA) over 10 years ago

  • Status changed from Open to Feedback
Actions #4

Updated by akr (Akira Tanaka) over 9 years ago

  • Related to Feature #11158: Introduce a Symbol.count API as a more efficient alternative to Symbol.all_symbols.size added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0