Just looking at a profile, I was struck by the cost of:
aStr = OUString();
Where we use the assignment to clear aStr; this in-lines a construction, a de-reference and an assign call ;-) it is done quite a bit too:
git grep ' = OUString()' | nl
it'd be nice to have the obvious cleanup implement a 'clear()' method on OString and OUString thus include/rtl/ustring.hxx and rtl/string.hxx
rtl_uString_new( &pData );
And then cleanup the call-sites I guess =)
I would like to work on this bug. Can you please provide more info about rtl_uString_new( &pData ) method and when will the clear() method be called?
P.S: This is my first bug.
I have implemented the clear() method on OString and OUString classes. I will replace appropriate assignments of '= OUString()' to call clear() method.
Can you please suggest how to test it?
Neato - glad you've done that; wrt. testing - I'd run "make check" in the top-level =) if that works before and after your patch, that's a good sign. The rest is just code-review I think. Looking forward to reading your patch =) please do -only- this change in it; no other cleanups of nearby code etc. [ that makes it much easier to review ].
I have pushed the patch to gerrit. Here's the link.
I uploaded the new patch set as per Stephan's comments. Kindly review!
Brij Mohan Lal Srivastava committed a patch related to this issue.
It has been pushed to "master":
fdo#86023 - O[U]String needs a 'clear' method
It will be available in 4.4.0.
The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp TopicCleanup)