Project

General

Profile

Actions

Feature #9953

open

set_trace_func values which could be frozen or symbols

Added by enebo (Thomas Enebo) over 10 years ago. Updated over 10 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:63223]

Description

I have been changing JRuby's tracing support internally and notice we churn through lots of extra Ruby objects per set_trace_func call. It strikes me that a couple of these values do not need to be allocated more than once. I propose:

  1. event_type becomes a symbol (or could be single frozen string per distinct event type)
  2. filename becomes a single frozen string per file (frozen per spec and possible single instance as impl-specific detail)

I find the value of these two values being mutable strings to be minimal and tracing speed will have less GC-pressure.

Updated by ko1 (Koichi Sasada) over 10 years ago

Hi,

event_type becomes a symbol (or could be single frozen string per distinct event type)

Now, TracePoint#event returns symbol.
I think it is enough and set_trace_func should not be modified.

I have no objection to make strings frozen.

filename becomes a single frozen string per file (frozen per spec and possible single instance as impl-specific detail)

Again, I have no objection to make strings frozen.

(maybe nobody depends on such behavior)

Actions

Also available in: Atom PDF

Like0
Like0