Closed Bug 1614639 Opened 4 years ago Closed 4 years ago

Most of the time spent in nsPermissionManager::InitDB before first paint is deleting expired permissions

Categories

(Core :: Permission Manager, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: florian, Assigned: mconley)

References

(Blocks 1 open bug)

Details

(Keywords: main-thread-io, Whiteboard: [fxperf:p2])

Attachments

(1 file)

Executing DELETE FROM moz_perms WHERE expireType = ?1 AND expireTime <= ?2 triggers 2 fsync syscalls on the main thread that are very slow compared to the other main thread I/O done by nsPermissionManager during early startup.

See this startup profile: https://perfht.ml/3bwQcr9

This is caused by the code at https://searchfox.org/mozilla-central/rev/a1592902acabf9bded973067133baaac1457f3d3/extensions/permissions/nsPermissionManager.cpp#2750-2770 that deletes expired permission entries before reading them all. I think we could instead ignore the expired entries while reading them, and later remove the expired entries from the database on disk during idle time, and preferably asynchronously.

Blocks: 1543203

This is a great find!

Whiteboard: [fxperf] → [fxperf:p2]

I just saw another startup profile where these fsync calls don't exist, so it may be that we only need to write on the disk if there were actually some permission entries that expired.

(In reply to Florian Quèze [:florian] from comment #0)

I think we could instead ignore the expired entries while reading them, and later remove the expired entries from the database on disk during idle time, and preferably asynchronously.

That should be quite feasible, I think.

(In reply to Florian Quèze [:florian] from comment #2)

I just saw another startup profile where these fsync calls don't exist, so it may be that we only need to write on the disk if there were actually some permission entries that expired.

That's certainly plausible...

Priority: -- → P2
Assignee: nobody → mconley
Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7ce25abc1155
Clear expired permissions from the database during idle off of the main thread. r=Ehsan
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: