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
This commit is contained in:
Ruslan Lesiutin
2025-04-29 12:03:11 -07:00
committed by Facebook GitHub Bot
parent b08f87aa90
commit 996630b5b5
@@ -151,7 +151,7 @@ RuntimeSamplingProfile::Sample convertHermesSampleToTracingSample(
/* static */ RuntimeSamplingProfile
HermesRuntimeSamplingProfileSerializer::serializeToTracingSamplingProfile(
const hermes::sampling_profiler::Profile& hermesProfile) {
std::vector<hermes::sampling_profiler::ProfileSample> hermesSamples =
const std::vector<hermes::sampling_profiler::ProfileSample>& hermesSamples =
hermesProfile.getSamples();
std::vector<RuntimeSamplingProfile::Sample> reconciledSamples;
reconciledSamples.reserve(hermesSamples.size());