Closed
Bug 29333
Opened 26 years ago
Closed 26 years ago
illegal use of nsString and performace problem in nsString::ToNewUTF8String
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
VERIFIED
FIXED
M15
People
(Reporter: ftang, Assigned: ftang)
References
Details
(Keywords: perf, Whiteboard: [PDT+]02/29-Need ftang to verify)
I found that I make a mistake when I implmeent the nsString::ToNewUTF8String
I copy some code from nsString::ToNewCString. Howerver, this slow down the
implementation. Also, it cause the assertion filed in 28424.
Here is the patch which fix it. It is simply, remove the unnecessary copy of
data in the nsCString constructor.
retrieving revision 1.69
diff -c -r1.69 nsString2.cpp
*** nsString2.cpp 2000/02/24 08:19:57 1.69
--- nsString2.cpp 2000/02/26 01:31:21
***************
*** 682,688 ****
* http://www.cis.ohio-state.edu/htbin/rfc/rfc2279.html
*/
char* nsString::ToNewUTF8String() const {
! nsCString temp(*this);
temp.SetCapacity(8); //ensure that we get an allocated buffer instead of the
common empty one.
// Caculate how many bytes we need
--- 682,688 ----
* http://www.cis.ohio-state.edu/htbin/rfc/rfc2279.html
*/
char* nsString::ToNewUTF8String() const {
! nsCString temp("");
temp.SetCapacity(8); //ensure that we get an allocated buffer instead of the
common empty one.
// Caculate how many bytes we need
Rickg- Please review.
This fix will increase our performance when we convert nsString to UTF8
| Assignee | ||
Updated•26 years ago
|
Whiteboard: wait for code review.
| Assignee | ||
Updated•26 years ago
|
Target Milestone: M14
| Assignee | ||
Updated•26 years ago
|
Target Milestone: M14 → M15
Putting on PDT+ radar for beta1.
Whiteboard: wait for code review. → [PDT+]wait for code review.
Subject: Re: code review, please
Date: Mon, 28 Feb 2000 12:44:36 -0800
From: rickg@netscape.com (Rick Gessner)
Organization: Netscape Communications
To: ftang@netscape.com
CC: bobj@netscape.com
References: <38BAB436.2C6F8AFA@netscape.com>
Frank --
You're on the right track, but you should call SetCapacity() with a larger
buffer than 8 bytes.
Rick
Whiteboard: [PDT+]wait for code review. → [PDT+]wait for code review. ETA 2/28
| Assignee | ||
Comment 4•26 years ago
|
||
fixed and check in. rickg- I do SetCapacity later.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
ftang, was this in the Feb29 build ok? Not sure to how to verify. Can you
verify?
QA Contact: leger → ftang
Whiteboard: [PDT+]wait for code review. ETA 2/28 → [PDT+]02/29-Need ftang to verify
Updating QA Contact to teruko to check on how to verify. Or ftang need to mark
this verified if code ok with latest build.
QA Contact: ftang → teruko
You need to log in
before you can comment on or make changes to this bug.
Description
•