Closed Bug 311511 Opened 19 years ago Closed 19 years ago

[FIX]NS_HexToRGB is slow and buggy

Categories

(Core Graveyard :: GFX, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file)

NS_HexToRGB uses NS_LossyConvertUTF16toASCII on the incoming string. This is slow (shows up in profiles for bug 297959) and buggy (fails http://web.mit.edu/bzbarsky/www/testcases/css-parsing/color-escape1.xml or the following testcase: data:text/html,<style>body {color: #\0166 f0000} body:before{content: "#\0166 f0000"}</style> ).
Attached patch Proposed fix (deleted) — Splinter Review
We have only one caller of NS_ASCIIHexToRGB and lots of callers of NS_HexToRGB, and the latter are much more perf-sensitive. Also fixes the CSS parsing bug...
Attachment #198800 - Flags: superreview?(dbaron)
Attachment #198800 - Flags: review?(dbaron)
Oh, I was thinking this is 1.9-type stuff, since we've had this bug forever. But if you think we should land this in 1.8, let me know.
Blocks: 297959
Keywords: perf
Priority: -- → P1
Summary: NS_HexToRGB is slow and buggy → [FIX]NS_HexToRGB is slow and buggy
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 198800 [details] [diff] [review] Proposed fix r+sr=dbaron No objections to putting it on the 1.8 branch...
Attachment #198800 - Flags: superreview?(dbaron)
Attachment #198800 - Flags: superreview+
Attachment #198800 - Flags: review?(dbaron)
Attachment #198800 - Flags: review+
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment on attachment 198800 [details] [diff] [review] Proposed fix I think this is worth taking on branch. While this is a somewhat long-standing intl/perf bug, the fix is very very safe, and there's always the "IE gets this right" aspect... ;)
Attachment #198800 - Flags: approval1.8rc1?
could make this a template function and eliminate all conversions, if you wanted...
I considered that, but the one caller of the ASCII version just isn't worth the extra codesize. It's a very non-per-sensitive caller.
Comment on attachment 198800 [details] [diff] [review] Proposed fix too late for non-critical changes.
Attachment #198800 - Flags: approval1.8rc1? → approval1.8rc1-
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: