GetPathFromFd shows up a lot in IO-heavy profiles
Categories
(Core :: XPCOM, enhancement)
Tracking
()
People
(Reporter: emilio, Unassigned)
Details
In this profile (for bug 1912253), the readlink call takes most of the time... Is this used only while profiling? Can we avoid some of that overhead?
Comment 1•1 year ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #0)
Is this used only while profiling?
I think so, yes. I think the IOInterposer is only initialized by the profiler when using one of the fileio features, at https://searchfox.org/mozilla-central/rev/6e6265bd607cbe4c96e714f86d3d9e36620f63d6/tools/profiler/core/platform.cpp#1144,1151,1164
Note that it's in an #if !defined(RELEASE_OR_BETA) block.
The strange thing in your profile is that the file io features aren't enabled, but maybe they were in a previous profiling session of the same Firefox process.
Can we avoid some of that overhead?
When looking at I/O and its cost in the profiler, I focused mostly on Windows, so... I don't know. Your guess will be as good as mine. Or better if you spend enough time looking into it.
Comment 2•1 year ago
|
||
The severity field is not set for this bug.
:nika, could you have a look please?
For more information, please visit BugBot documentation.
Comment 3•1 year ago
|
||
I believe the IOInterposer is a thing which is initialized specifically by the profiler. It makes sense that it would be somewhat expensive, as it is querying OS level information about the path on the filesystem corresponding to a specific file descriptor, which is not super normal information to query. This could also have an outsized impact on I/O which would otherwise be quite fast because it does not require querying complex parts of the filesystem.
I don't have any great ideas for how we could improve this without some kind of caching, which is very risky as there's no guarantee that the only way the FD can be closed and then re-used is through the interposed NSPR methods.
Marking as an enhancement as it's a profiling performance improvement, and shouldn't impact actual users.
Description
•