Closed Bug 74655 Opened 24 years ago Closed 24 years ago

40% of reply time in mailcompose spent converting linefeeds

Categories

(Core :: DOM: Editor, defect, P2)

x86
Windows 2000
defect

Tracking

()

VERIFIED FIXED
mozilla0.9

People

(Reporter: hyatt, Assigned: mozeditor)

References

Details

40% of reply time on large messages is spent in ReplaceSubstring. The original caller of this method is in the mailcompose code. It is called TranslateLineBreaks. This function should first be removed from mail compose, but even after it is gone, editor does this conversion in nsHTMLDataTransfer. Just grep for the four occurrences of ReplaceSubstring in the editor code. This linefeed conversion should be done without performing a replace, since you end up thrashing in memmove.
assigning to jfrancis
Severity: normal → major
Priority: -- → P2
Target Milestone: --- → mozilla0.9
I checked in mozilla/xpcom/io/nsLinebreakConverter.cpp/h a long time ago which does efficient linebreak conversions on strings (though the nsString version doesn't work on nsAutoStrings). It seems that the right thing to do would be to rewrite these to use some of the new string class goodness, and encourage their use everywhere.
Assignee: beppe → jfrancis
Places that do inefficient linebreak conversions: /editor/base/nsHTMLEditor.cpp, line 918 -- inputString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), /editor/base/nsHTMLDataTransfer.cpp, line 199 -- inputString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), /htmlparser/src/nsViewSourceHTML.cpp, line 1185 -- theStr.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\ n")); /layout/html/forms/src/nsFormControlHelper.cpp, line 122 -- aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n")); /mailnews/compose/src/nsMsgCompUtils.cpp, line 2069 -- aInString.ReplaceSubstring(NS_ConvertASCIItoUCS2(CRLF), NS_ConvertASCIItoUCS2(LF));
simon: do your converters work with the new string api's? hyatt: I beelieve i can avoid this whole issue in the work I'm doing now. I have to go thrugh the string a character at a time anyway to do whitespace conversion. I can look for crlf's etc on the way and treat them all as needed.
Joe: no. Nor do they work with nsAutoStrings.
Blocks: 22486
the message compose part is covered by bug 74901
fix checked in
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
v=jfrancis
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.