Eliminate double allocation in CSSParserImpl::ParseProperty()

RESOLVED FIXED in mozilla0.9.7

Status

()

Core
CSS Parsing and Computation
RESOLVED FIXED
16 years ago
16 years ago

People

(Reporter: jst, Assigned: jst)

Tracking

({perf})

Trunk
mozilla0.9.7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [HAVE FIX])

Attachments

(2 attachments)

(Assignee)

Description

16 years ago
In CSSParserImpl::ParseProperty() we do:

  nsString* str = new nsString(aPropValue);

which will allocate the nsString object, *and* allocate storage for the string.
In stead of allcating a nsString we should allocate a nsAutoString which will
make us allocate only once if aPropValue fits in the internal nsAutoString
buffer, which is the case most of the time.

Patch coming up...
(Assignee)

Comment 1

16 years ago
Created attachment 59576 [details] [diff] [review]
Allocate nsAutoString, and speed up NS_NewHTMLReflowCommand a bit...
(Assignee)

Comment 2

16 years ago
Taking bug. Reviews?
Assignee: dbaron → jst
Keywords: perf
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.7
(Assignee)

Comment 3

16 years ago
Created attachment 59577 [details] [diff] [review]
More nsAutoString fun...
Attachment #59576 - Flags: review+
Comment on attachment 59576 [details] [diff] [review]
Allocate nsAutoString, and speed up NS_NewHTMLReflowCommand a bit...

r=dbaron, although I wish we weren't bound to nsIUnicharInputStream
(Assignee)

Comment 5

16 years ago
Yeah, me too...
Comment on attachment 59577 [details] [diff] [review]
More nsAutoString fun...

+  *aInstancePtrResult cmd = new nsHTMLReflowCommand(aTargetFrame, aReflowType,

Does this compile?  I don't think you want |cmd| in there...
(Assignee)

Comment 7

16 years ago
Hmm, yeah, loose the |cmd| :-) My build didn't like that either, but I didn't
see my build had stopped before attaching the patch :-)
(Assignee)

Comment 8

16 years ago
Fix checked in.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.