Closed
Bug 563711
Opened 14 years ago
Closed 14 years ago
Optimize nsHTMLContentSerializer::AppendAndTranslateEntities
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: smaug, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
1.30 KB,
text/html
|
Details | |
4.56 KB,
patch
|
Details | Diff | Splinter Review | |
4.18 KB,
patch
|
sicking
:
review+
|
Details | Diff | Splinter Review |
If there are lots of entities to translate, nsHTMLContentSerializer::AppendAndTranslateEntities takes way too much time of ::GetInnerHTML (like 66%). String modifications and memory (de)allocation are the ones which take most of the time.
Comment 1•14 years ago
|
||
I'm trying to do something.
Comment 2•14 years ago
|
||
The result of the test on my computer with the current trunk is: total: 91999, avg 183.998 with this patch: total: 84945, avg 169.89 It's better, but not as better than safari: total: 63616, avg 127.232 Olli, do you have ideas for other improvements ?
Reporter | ||
Comment 3•14 years ago
|
||
Well, we should improve string handling in serializers in general, but in this particular case I think AppendASCIItoUTF16 is pretty heavy. It needs to increase the capacity of aOutputStr all the time. So, perhaps collecting strings to some array and then call SetCapacity on the aOutputStr only once after loops and then Append strings to aOutputStr could help, maybe.
Reporter | ||
Comment 4•14 years ago
|
||
Also, I think string.AppendASCII(ascii) is actually faster than AppendASCIItoUTF16(ascii, string). The latter one creates some extra temporary string objects. I wonder if there is some other difference in the behavior.
Reporter | ||
Comment 5•14 years ago
|
||
Another testcase is in bug 561717
Reporter | ||
Comment 6•14 years ago
|
||
Laurent, do you want a review for the patch? (gecko is already in many innerHTML cases faster than trunk webkit, and would be great to get faster serializers. This would be one step.)
Reporter | ||
Comment 7•14 years ago
|
||
This uses AppendASCII, which is faster and ok to use at least in this case. Added also the missing Truncate call.
Attachment #444857 -
Flags: review?(laurent)
Reporter | ||
Comment 8•14 years ago
|
||
Jonas, perhaps you could review this.
Attachment #444857 -
Attachment is obsolete: true
Attachment #444961 -
Flags: review?(jonas)
Attachment #444857 -
Flags: review?(laurent)
Attachment #444961 -
Flags: review?(jonas) → review+
Reporter | ||
Comment 9•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/1b59e562e0f0 Marking this fixed once this has passed the tests.
Reporter | ||
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•