From eec8c3e41fe8b3431431f2a2f63613129c375f71 Mon Sep 17 00:00:00 2001 From: Ibrahim Awwal Date: Thu, 21 Mar 2024 17:14:24 -0700 Subject: [PATCH 1/2] Freeze string literals in AutoInstrument layer I think if you have a lot of AutoInstrumentation going on, this results in a lot of repeated memory allocations for the same string. --- lib/scout_apm/auto_instrument/layer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/scout_apm/auto_instrument/layer.rb b/lib/scout_apm/auto_instrument/layer.rb index 46c51c0b..edc91a68 100644 --- a/lib/scout_apm/auto_instrument/layer.rb +++ b/lib/scout_apm/auto_instrument/layer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ScoutApm def self.AutoInstrument(name, backtrace) From e9d9d312b5f1bd706ea87a23c414c287a727d146 Mon Sep 17 00:00:00 2001 From: Ibrahim Awwal Date: Thu, 21 Mar 2024 17:17:12 -0700 Subject: [PATCH 2/2] Also add frozen_string_literal to tracked_request.rb 'AutoInstrument' is used in a comparison here. --- lib/scout_apm/tracked_request.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/scout_apm/tracked_request.rb b/lib/scout_apm/tracked_request.rb index 3ea7202c..758b7e9a 100644 --- a/lib/scout_apm/tracked_request.rb +++ b/lib/scout_apm/tracked_request.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true +# # A TrackedRequest is a stack of layers, where completed layers (go into, then # come out of a layer) are forgotten as they finish. Layers are attached to # their children as the process goes, building a tree structure within the