Closed Bug 312681 Opened 19 years ago Closed 19 years ago

optimized nsTSubstring Replace/Assign for single-character replacement

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bryner, Assigned: bryner)

References

Details

(Keywords: perf)

Attachments

(1 file)

Obviously building up a string a character at a time is often not the most efficient way to do it, but we penalize it even more by using memcpy() for this case. I did some quick testing on Windows (with a small test app) and found that just using pointer assignment is significantly faster (maybe 50%) than calling memcpy for repeated single-character copying.
Attached patch patchSplinter Review
Attachment #199776 - Flags: superreview?(darin)
Attachment #199776 - Flags: review?(darin)
Comment on attachment 199776 [details] [diff] [review] patch "mData[cutStart] = c" reads a bit better IMO. r+sr=darin
Attachment #199776 - Flags: superreview?(darin)
Attachment #199776 - Flags: superreview+
Attachment #199776 - Flags: review?(darin)
Attachment #199776 - Flags: review+
checked in
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
*** Bug 311458 has been marked as a duplicate of this bug. ***
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: