Closed Bug 1688312 Opened 5 years ago Closed 5 years ago

Consider to use nsAtoms in PerformanceEntry

Categories

(Core :: Performance: General, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(3 files)

Attached file usertiming.html

There are lots of string comparisons when dealing with PerformanceEntries.
In many cases those could become simple pointer comparisons if nsAtoms were used.

However, creating atoms does add some overhead.
The testcase shows that creating 100000 entries on my machine goes from
~300ms to ~330ms, but accessing getEntriesByName (1000 times) goes down from ~800ms to
500ms with the patch I'm about to upload.

In theory using atoms is also more likely to share memory.

(I happened to notice this while looking at bug 1686930)

And yes, 100000 entries sounds like a lot, but that is what Facebook used until recently.

Severity: -- → S3
Priority: -- → P3

We might want to also just store the entries in totally different way.
Like a hashtable where name is used as the key and value is an array of entries with that name.
Though that wouldn't help too much because of entryType.

Attached file usertiming_bytype.html

This is using different API, getEntriesByType.
If Chrome is really good with the other testcase using getEntriesByName, it is really bad
with getEntriesByType.
I had to lower the iterations from 1000 to 100 to ensure Chrome doesn't kill its child process.

Pushed by opettay@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bd266a6e1e78 Consider to use nsAtoms in PerformanceEntry, r=sefeng
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: