Closed Bug 1689698 Opened 3 years ago Closed 3 years ago

Intermediate preloading uses 40% CPU for over 10 seconds

Categories

(Core :: Security: PSM, defect)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Performance Impact ?
Tracking Status
firefox87 --- fixed

People

(Reporter: mstange, Assigned: keeler)

Details

Attachments

(1 file)

Profile: https://share.firefox.dev/3iYA5Xs
(originally from bug 1679506 comment 2)

This profile shows many many requests to .pem files, over the span of at least 10 seconds, with about 40% CPU usage, on the main thread. That seems a little high.

Is there something we can do to reduce this? Could the files be combined into bigger "chunk" files? Could the parsing be sped up?

This patch improves the performance of DER.jsm by changing readBytes to use
slice rather than repeatedly calling readByte.
Additionally, this patch removes the validation that the input to DERDecoder
consists of an array of integers in the range [0, 255]. This check is
unnecessary for all current consumers of DER.jsm because the input comes from
atob, which only outputs values in that range. If other consumers use DER.jsm
in the future, they will have to determine whether or not they need to validate
the input themselves first.

Assignee: nobody → dkeeler
Status: NEW → ASSIGNED
Pushed by dkeeler@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eb3ee8b2a4d7
improve performance of DER.jsm r=mbirghan
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch

Has this improved things? My measurements indicated this would reduce the work done by 60-70%, but I didn't directly measure the work originally measured in comment 0.

Flags: needinfo?(mstange.moz)

I'm not sure how to exercise this code. The profile I saw this in was obtained by a QA person investigating a different issue, and the preloading only happened by accident during the profiled window. Is there a way I can manually trigger this?

Flags: needinfo?(mstange.moz)

(In reply to Markus Stange [:mstange] from comment #5)

I'm not sure how to exercise this code. The profile I saw this in was obtained by a QA person investigating a different issue, and the preloading only happened by accident during the profiled window. Is there a way I can manually trigger this?

Maybe we could ask the QA person? 😅
This code generally only gets run once, to download all known intermediate certificates. It's on an idle timer, so I suppose you could create a new profile, start the profiler, and let the browser sit for a bit?

Performance Impact: --- → ?
Whiteboard: [qf]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: