Closed Bug 84194 Opened 24 years ago Closed 24 years ago

Patch that makes color parsing faster

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla0.9.3

People

(Reporter: bratell, Assigned: bratell)

References

()

Details

(Keywords: perf, Whiteboard: [fix in hand])

Attachments

(4 files)

The attached patch makes color parsing twice as fast. It doesn't matter on pages beside the one in the URL which has 10000 colors specified, but anyway, it makes that page load about 1% faster.
Blocks: 54542
Keywords: patch, perf
Whiteboard: patch attached
Thanks for the patch, I'll let Harish deal with this one. One comment about the patch tho: + if (aString.Length() == 0) { + return PR_FALSE; + } should use if (aString.IsEmpty()). I'm glad to sr= this once Harish has a look at this (and once I actually *read* the patch).
Assignee: jst → harishd
Harish, can you take a look at this patch so we can get it in? No sense in letting it go to waste. Thanks.
Nit pick: nscolor declaration, i.e. nscolor color=0, could be delayed further. And with suggested change from Johnny r=harishd.
I've done the two changes mentioned, but looking at this again, I see an even greater optimization. No color name can start at '#', right? So we should look at the first char, and if it's '#' do the numerical conversion. I will attach a patch that does that in a little time.
Attached patch Updated patchSplinter Review
This was better. Quantify numbers for 10000 calls: In the code today 72.1 ms (1.73% of the total time) The last patch 16.3 ms (0.43%) (The percentages are approximate since I played with other stuff affecting the total time for the page). harishd, can you take a new look? jst, I think this is mature enough for a real sr?
looks good to me. r=harishd.
Status: NEW → ASSIGNED
Blocks: 83989
Blocks: 86582
No longer blocks: 83989
Looks good to me, sr=jst
Target Milestone: --- → mozilla0.9.3
Worth getting into .9.2/limbo?
Blake: I would say so.
Blake: I would say so.
Whiteboard: patch attached → [fix in hand]
I finally noticed that " " (SPACE) is missing from the set of whitespace chars. That's fixed in my tree now.
harsihd, jst, here is a new patch that also strips SPACE. Can I have a new r/sr?
sr=jst
r=harishd. Daniel: since you did all the work...reassigning bug to u :-)
Assignee: harishd → bratell
Status: ASSIGNED → NEW
Fix checked in
...and the bug is therefore FIXED.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
QA Contact: lchiang → stummala
Component: DOM: Abstract Schemas → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: