Open Bug 1861991 Opened 1 year ago Updated 11 months ago

Bad mutex contention when allocating strings in JSON.parse() in TodoMVC-Javascript-ES6-Webpack on Android

Categories

(Core :: Performance, defect)

defect

Tracking

()

Performance Impact none

People

(Reporter: jnicol, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Profile: https://share.firefox.dev/3tZ0KNq

This is allocating from the js::StringBufferArena arena in NewStringCopyNDontDeflateNonStaticValidLength()

I don't see nearly the same amount of contention in the windows profiles

It looks like the contention is caused by js::gc::BackgroundFreeTask::run
https://share.firefox.dev/478LdsW

Yeah had noticed that, which could explain why we at one point saw wins from bug 1850231. (But perhaps the downsides of disabling background tasks cancels it out enough that the win is inconclusive)

Whiteboard: [sp3]
See Also: → 1814813

I think this is probably mostly due to samply not handling off-cpu samples correctly.

Here are two profiles, both converted from the same perf.json which was captured using simpleperf with --trace-offcpu. The first was converted using a samply which doesn't understand simpleperf's off-cpu data correctly, like the original profile I posted in comment 0. The second was converted using a samply I've patched to interpret the off-cpu data correctly.

Without samply fix: https://share.firefox.dev/49hX2yz
With samply fix: https://share.firefox.dev/49leZN1

Without the fix we see a huge amount of time spent in the kernel's schedule(), hence why I filed this bug. But with the fix the kernel time is almost completely gone. We see a slight increase in the self time in syscall() when we are off cpu, but it's not indicative of a major issue. This matches what we see in the windows profiles.

It's a mystery to me why we see so much time in schedule() without the fix, though.

Performance Impact: --- → none
You need to log in before you can comment on or make changes to this bug.