Closed Bug 1669357 Opened 4 years ago Closed 4 years ago

Slow `nsWindow::GetWorkspaceID`, possibly caused by virtual desktop

Categories

(Firefox :: Session Restore, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1640852

People

(Reporter: sefeng, Unassigned)

References

(Depends on 1 open bug)

Details

Here's a profile https://share.firefox.dev/32P760O in bug 1662825, and there is some slow usage of _saveState in the parent process. And it turned out nsWindow::GetWorkspaceID was the bottleneck.

I think we should figure out if we can improve the performance here.

There was some conversation about this on Matrix.

agashlin: From the profile, yes the virtual desktop for each window is being saved, in _updateWindowFeatures. 
Not sure why it would be taking so long, though. I don't see a way to disable that check within Firefox. 
Might be a good candidate for caching when the window moves rather than getting it with the window dimension every time (not that I'm volunteering).
Caching doesn't solve the problem if it's blocking for 2.5s at a time, though
mhowell: we save the virtual desktop ID even if the user has not actually created any 
virtual desktops (because we can't really detect that without reading the IDs, and you're 
always using a default one in any case), so this doesn't necessarily mean they have any virtual desktops on
I also have no explanation for why that call could be so slow; all that's in there is
one out-of-process COM call into the window manager. If that's that slow, then 
I have to feel like something is wrong that's outside of our control.

If it really is just the GetVirtualDesktopManager call that's so slow, then we ought 
to be able to cache the result of that, so at least we'd only get one hang

The root cause seems to be identified in bug 1645473

Depends on: 1645473
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.