Closed Bug 93066 Opened 24 years ago Closed 23 years ago

Shouldn't use FindCharInSet when searching for one char

Categories

(MailNews Core :: MIME, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.2beta

People

(Reporter: bratell, Assigned: bratell)

References

()

Details

(Keywords: perf)

Attachments

(1 file)

FindChar is (much) more efficient than FindCharInSet when searching for just one char. Still there are several misusers in the tree. /extensions/xmlextras/base/src/nsXMLHttpRequest.cpp, line 406 -- end = contentType.FindCharInSet("\"", start ); /intl/strres/src/nsAcceptLang.cpp, line 114 -- PRInt32 dash = lc_tmp.FindCharInSet("-"); /intl/strres/src/nsAcceptLang.cpp, line 169 -- PRInt32 dash = acceptLang.FindCharInSet("-"); /intl/strres/src/nsStringBundle.cpp, line 446 -- PRInt32 dash = lc_name.FindCharInSet("-"); /xpcom/tests/windows/nsStringTest.h, line 391 -- pos = T2.FindCharInSet("A"); /xpcom/tests/windows/nsStringTest.h, line 394 -- pos=T2.RFindCharInSet("A",2); /content/html/document/src/nsHTMLDocument.cpp, line 470 -- end = contentType.FindCharInSet("\"", start); /content/xml/document/src/nsXMLDocument.cpp, line 409 -- end = contentType.FindCharInSet("\"", start ); /xpfe/components/search/src/nsInternetSearchService.cpp, line 4988 -- quoteEndOffset = resultItem.FindCharInSet(">", quoteStartOffset); /xpfe/components/search/src/nsInternetSearchService.cpp, line 5123 -- PRInt32 protocolOffset = site.FindCharInSet(":", 0); /xpfe/components/search/src/nsInternetSearchService.cpp, line 5131 -- PRInt32 slashOffset = site.FindCharInSet("/", 0); /xpfe/components/search/src/nsInternetSearchService.cpp, line 5173 -- PRInt32 anchorEnd = resultItem.FindCharInSet(">", quoteEndOffset); /mailnews/base/util/nsMsgMailNewsUrl.cpp, line 604 -- PRInt32 pos = mAttachmentFileName.RFindCharInSet("."); /mailnews/mime/src/mimedrft.cpp, line 1768 -- PRInt32 pos = contentType.FindCharInSet(";"); /mailnews/mime/src/mimemoz2.cpp, line 244 -- PRInt32 pos = contentType.FindCharInSet(";"); If I get the optimizations into FindCharInSet that is in another bug, that function will be even more optimized to handle sets larger than one char.
Keywords: perf
Component: Browser-General → Tracking
QA Contact: doronr → chofmann
There was only one offending module left. Someone must have cleaned this up (alecf?) since this bug was filed. Will attach patch. alefc and sspitzer, can you r= and sr= it?
Status: NEW → ASSIGNED
Component: Tracking → MIME
Product: Browser → MailNews
Target Milestone: --- → mozilla1.2beta
Replacing 2 occurrances of FindCharInSet with FindChar because FindChar is simpler and faster and it's confusing to use FindCharInSet when searching for a single character.
Comment on attachment 100134 [details] [diff] [review] Replacing FindCharInSet with FindChar yeah, I think I may have cleaned some of the others up. sr=alecf
Attachment #100134 - Flags: superreview+
Attachment #100134 - Flags: review?(sspitzer)
Attachment #100134 - Flags: review?(sspitzer) → review+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: