Closed Bug 444779 Opened 16 years ago Closed 16 years ago

Make XPC_XOW_ClassNeedsXOW faster

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mrbkap, Assigned: mrbkap)

Details

(Keywords: perf)

Attachments

(1 file, 2 obsolete files)

In bug 407216 comment 33, jorendorff noticed that XPC_XOW_ClassNeedsXOW took a non-trivial percent of time (showing up in profiles, even). In his words, this is "silly." We should fix it.

I have a patch that *should* make things better. Jorendorff said he'd test it, but I'd like to have a bug to hold the patch in.
Attached patch Possible fix (obsolete) — Splinter Review
This should bring us down from 4 calls to strncmp to at most 2 per call.
Attachment #329094 - Flags: review?(jorendorff)
Comment on attachment 329094 [details] [diff] [review]
Possible fix

+  switch (*name++) {

Doing this increment inside the cases below would save you the increment instruction in the case where we miss the cases.
Attached patch With jst's suggestion (obsolete) — Splinter Review
Attachment #329094 - Attachment is obsolete: true
Attachment #329144 - Flags: review?(jorendorff)
Attachment #329094 - Flags: review?(jorendorff)
Sorry for the spam... The last patch had a typo.
Attachment #329144 - Attachment is obsolete: true
Attachment #329146 - Flags: review?(jorendorff)
Attachment #329144 - Flags: review?(jorendorff)
Version: unspecified → Trunk
Comment on attachment 329146 [details] [diff] [review]
With jst's suggestion

OK, I Shark-profiled the Hamlet benchmark from bug 407216 with and without this little patch.

Without the patch, Firefox is spending 2.4% of its time in this function.

With the patch that goes to 0.26%; apparently most names go to the default:, missing strcmp entirely.
Attachment #329146 - Flags: review?(jorendorff) → review+
Attachment #329146 - Flags: superreview+
Pushed as http://hg.mozilla.org/index.cgi/mozilla-central/rev/41d5a8915ca2
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: