From 996630b5b5abcb07dc2e8f90a62e4d0d8be73fef Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Tue, 29 Apr 2025 12:03:11 -0700 Subject: [PATCH] Avoid copying samples list when serializing (#50985) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50985 # Changelog: [Internal] There may be tens of thousands of samples stored, so we should avoid copying it. I don't think we should restrict it from being copied, though, but we don't need it to copy in this case. Reviewed By: huntie, dannysu Differential Revision: D73106950 fbshipit-source-id: 45c027ea8bfc3424fe3428f5578d5bed3d1cdda9 --- .../chrome/HermesRuntimeSamplingProfileSerializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp index 56877c27278..a7375112f0c 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeSamplingProfileSerializer.cpp @@ -151,7 +151,7 @@ RuntimeSamplingProfile::Sample convertHermesSampleToTracingSample( /* static */ RuntimeSamplingProfile HermesRuntimeSamplingProfileSerializer::serializeToTracingSamplingProfile( const hermes::sampling_profiler::Profile& hermesProfile) { - std::vector hermesSamples = + const std::vector& hermesSamples = hermesProfile.getSamples(); std::vector reconciledSamples; reconciledSamples.reserve(hermesSamples.size());