Skip to content

Commit 5a1264d

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
RPP: fix extra clone of array in RendererHandler
If you enable the debug experiment, we render samples onto the UI. The code in `RendererHandler` to do this checked `if(jsSamples)` but `jsSamples` is an array, so this is always true. The code within then creates a clone of `allTraceEntries` and then does another sort on `thread.entries`, both of which we actually only want to do if the samples _have any length_. This CL fixes the check to ensure we don't needlessly clone the arrays. [email protected] Bug: 436491188 Change-Id: I9fa5e4f0bfaf542d0cf0fd1cdae0dd74825730d4 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6827313 Commit-Queue: Alina Varkki <[email protected]> Auto-Submit: Jack Franklin <[email protected]> Reviewed-by: Alina Varkki <[email protected]>
1 parent da76b6d commit 5a1264d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

front_end/models/trace/handlers/RendererHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,10 @@ export function buildHierarchy(
343343
allTraceEntries = allTraceEntries.concat(profileCalls);
344344
thread.entries = Helpers.Trace.mergeEventsInOrder(thread.entries, profileCalls);
345345
thread.profileCalls = profileCalls;
346+
346347
// We'll also inject the instant JSSample events (in debug mode only)
347348
const jsSamples = samplesIntegrator.jsSampleEvents;
348-
if (jsSamples) {
349+
if (jsSamples.length) {
349350
allTraceEntries = [...allTraceEntries, ...jsSamples];
350351
thread.entries = Helpers.Trace.mergeEventsInOrder(thread.entries, jsSamples);
351352
}

0 commit comments

Comments
 (0)