Closed Bug 96529 Opened 23 years ago Closed 23 years ago

delay loading of unicharutil in nsString case conversion code

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.6

People

(Reporter: ftang, Assigned: ftang)

References

Details

(Keywords: perf)

Attachments

(1 file, 2 obsolete files)

this is a spin off from 75041
I find out one of the reason unicharutil get load into memory is nsString case
conversion. I have a fix for it and will include later for scc to review.
Blocks: 75041
with this one and 96530, we can remove the loading of unicharutil.dll with
-chrome blank.xul. 
Status: NEW → ASSIGNED
add perf
Keywords: perf
Target Milestone: --- → mozilla0.9.5
add jbetak to the cc list. 
How about something like attachment 47922 [details] [diff] [review]? This basically does the same thing as
your patch, ftang, but avoids scanning the string first. It proceeds using the
ASCII to upper/lower conversion until it hits a non-ASCII character. At that
point, it faults in the unicode utilities and lets it process the remainder of
the string. (Check my math to make sure I got the length parameter right.)
while (cp <= end) {
....
+      result = PRInt32(aToUpper
+                       ? gCaseConv->ToUpper(cp, cp, end - cp)
+                       : gCaseConv->ToLower(cp, cp, end - cp));

while cp == end, it will go into the loop and end-cp will be equal to 0. 
Is that right? should it be end - cp + 1 ?
*** Bug 98222 has been marked as a duplicate of this bug. ***
ftang: you are right! But perhaps a cleaner fix might be to simply let |end|
point one past the end of the string, and change the loop termination condition
to ``cp strictly less-than end''. Let me attach a patch...
Blocks: 103175
Comment on attachment 48230 [details] [diff] [review]
make |end| point one past end of the string, alter loop condition to strictly less-than

r=ftang
It looks better.
Attachment #48230 - Flags: review+
seeking for sr
Target Milestone: mozilla0.9.5 → mozilla0.9.6
Attachment #46902 - Attachment is obsolete: true
Attachment #47922 - Attachment is obsolete: true
Blocks: 104056
Comment on attachment 48230 [details] [diff] [review]
make |end| point one past end of the string, alter loop condition to strictly less-than

/me grumbles about selective respect for the 80 column limit.

sr=brendan@mozilla.org
Attachment #48230 - Flags: superreview+
Blocks: 104060
No longer blocks: 104056
fixed and check in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
No longer blocks: 104060
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: