-
-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
🤞 phase/openPost is being triaged manuallyPost is being triaged manually
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
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.
Metadata
Metadata
Assignees
Labels
🤞 phase/openPost is being triaged manuallyPost is being triaged manually