Closed Bug 74904 Opened 24 years ago Closed 24 years ago

ReplaceSubstring is O(n^2) (SLOW SLOW SLOW)

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 82456
mozilla0.9.2

People

(Reporter: hyatt, Assigned: scc)

References

Details

(Keywords: perf)

The ReplaceSubstring implementation is O(n^2), when it should be O(n). 40% of mailnews reply performance on large messages is in this method.
Blocks: 22486
|ns[C]String::ReplaceSubstring| doesn't even work in all cases; rickg left a warning there //WARNING: This is not working yet!!!!! I was just about to provide a new implementation that works on all strings, not just |ns[C]String|s. See bug #74896.
Blocks: 70090
Status: NEW → ASSIGNED
Component: Browser-General → String
OS: other → All
Hardware: PC → All
Target Milestone: --- → mozilla0.9
Blocks: 75164
No longer blocks: 70090
These are the 0.9 bugs that didn't make it, and that I intend to fix in 0.9.1
Target Milestone: mozilla0.9 → mozilla0.9.1
re-targeting milestones, starting from a clean slate
Target Milestone: mozilla0.9.1 → ---
marking the functionality blockers for immediate attention in mozilla0.9.1
Target Milestone: --- → mozilla0.9.1
What is being replaced in the mail/news case? If |ReplaceSubstring| is being used for CRLF conversion, then a more specific solution may be appropriate. David?
If you're going to work on ReplaceSubstring(), how about moving the real implementation into a global function that works on an nsAWritableString, and then re-implement the ns[C]String::ReplaceSubstring() method in terms of that? (That's probably already your plan, but I thought I'd make it explicit.) There are some places in my own code where I could use this.
let's land this in 0.9.2. let drivers know if this creates problems. thanks.
Target Milestone: mozilla0.9.1 → mozilla0.9.2
The fix to this bug is that we're going to replace the entire implementation of |ReplaceSubstring| with the new |nsSubstituteC?String| generator. See bug #82456. There's no perfect way to mark this bug for this resolution (it's not FIXED yet, it's not INVALID, it's not WONTFIX). We'll settle for making it a dup of the new bug. *** This bug has been marked as a duplicate of 82456 ***
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.