Closed Bug 413569 Opened 18 years ago Closed 18 years ago

XPCWrappedNative::CallMethod() unconditionally initializes a string on the stack for all calls.

Categories

(Core :: XPConnect, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9beta3

People

(Reporter: jst, Assigned: jst)

References

Details

Attachments

(2 files)

Right now, XPCWrappedNative::CallMethod() always initializes an nsVoidableString on the stack for each call, whether it's needed or not. This string (array size of 1) is used for methods that return string values or uses string out params, but we pay to price of calling the ctor and dtor for each call. It's not a huge deal, but it does show up as a couple of % of the time spent in XPCWrappedNative::CallMethod(), and it's easy to get rid of. See attached patch.
Flags: blocking1.9+
Attachment #298583 - Flags: superreview?(jonas)
Attachment #298583 - Flags: review?(jonas)
Priority: -- → P1
Comment on attachment 298583 [details] [diff] [review] Reserve space on the stack, but only initialize/destroy the strings when needed. Feel free to remove the PARAM_AUTOSTRING_COUNT define and remove all the crud about handling multiple autostrings. Also feel free to call it nsAutoString :) r/sr=me
Attachment #298583 - Flags: superreview?(jonas)
Attachment #298583 - Flags: superreview+
Attachment #298583 - Flags: review?(jonas)
Attachment #298583 - Flags: review+
Fix checked in.
Status: NEW → RESOLVED
Closed: 18 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: