diff --git a/src/profile-logic/transforms.js b/src/profile-logic/transforms.js index e4bf11ac003..9a8f07cc124 100644 --- a/src/profile-logic/transforms.js +++ b/src/profile-logic/transforms.js @@ -906,7 +906,9 @@ export function dropFunction( const { stackTable, frameTable } = thread; // Go through each stack, and label it as containing the function or not. - const stackContainsFunc: Array = []; + // stackContainsFunc is a stackIndex => bool map, implemented as a U8 typed + // array for better performance. 0 means false, 1 means true. + const stackContainsFunc = new Uint8Array(stackTable.length); for (let stackIndex = 0; stackIndex < stackTable.length; stackIndex++) { const prefix = stackTable.prefix[stackIndex]; const frameIndex = stackTable.frame[stackIndex]; @@ -915,15 +917,15 @@ export function dropFunction( // This is the function we want to remove. funcIndex === funcIndexToDrop || // The parent of this stack contained the function. - (prefix !== null && stackContainsFunc[prefix]) + (prefix !== null && stackContainsFunc[prefix] === 1) ) { - stackContainsFunc[stackIndex] = true; + stackContainsFunc[stackIndex] = 1; } } return updateThreadStacks(thread, stackTable, (stack) => // Drop the stacks that contain that function. - stack !== null && stackContainsFunc[stack] ? null : stack + stack !== null && stackContainsFunc[stack] === 1 ? null : stack ); }