Initial checklist
Problem
In the compile function, a new object is created via Object.assign for every event in the token stream:
while (++index < events.length) {
const handler = config[events[index][0]]
if (own.call(handler, events[index][1].type)) {
handler[events[index][1].type].call(
Object.assign(
{sliceSerialize: events[index][2].sliceSerialize},
context
),
events[index][1]
)
}
}
This can result in thousands of object allocations. These short-lived objects create GC pressure, which shows up as garbage collection pauses in CPU profiles.
Current solutions
N/A
Proposed solutions
Since sliceSerialize is the only property that varies per event, we can reuse a single context object and mutate just that property.
Initial checklist
Problem
In the compile function, a new object is created via Object.assign for every event in the token stream:
This can result in thousands of object allocations. These short-lived objects create GC pressure, which shows up as garbage collection pauses in CPU profiles.
Current solutions
N/A
Proposed solutions
Since sliceSerialize is the only property that varies per event, we can reuse a single context object and mutate just that property.