diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index 661f652f36213e645daf1e9ac1721593886ca903..170407cd28036e977728f6e839c5c2a9663c8d77 100644
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -231,7 +231,7 @@ void LLBadge::draw()
 			// Calculate badge size based on label text
 			//
 
-			LLWString badge_label_wstring = mLabel;
+			const LLWString& badge_label_wstring = mLabel.getWString();
 
 			S32 badge_label_begin_offset = 0;
 			S32 badge_char_length = S32_MAX;
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index f407cd87ec2256a23d3bfc835a773285e7955997..c283cdc4007751b5672fc305201de878590796e3 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -332,9 +332,9 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b
 				&& current_color != mParagraphColorSegments.end() )
 			{
 				LLWString color_text = mParagraphText.substr( paragraph_offset + drawn, current_color_length );
-				line.mLineColorSegments.push_back( LineColorSegment( color_text,			//Append segment to line.
+				line.mLineColorSegments.emplace_back(color_text,			//Append segment to line.
 												(*current_color).mColor, 
-												x_position ) );
+												x_position);
 												
 				x_position += font->getWidth( color_text.c_str() );	//Set up next screen position.
 				
diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h
index bc0e765cb2afa3af0270e989deb44a1183bd4569..71c47e71737e660033ab12d23b319afffc9ad5c7 100644
--- a/indra/llui/llconsole.h
+++ b/indra/llui/llconsole.h
@@ -84,7 +84,7 @@ class LLConsole : public LLFixedBuffer, public LLUICtrl, public LLInstanceTracke
 	class LineColorSegment
 	{
 		public:
-			LineColorSegment(LLWString text, LLColor4 color, F32 xpos) : mText(text), mColor(color), mXPosition(xpos) {}
+            LineColorSegment(LLWString text, LLColor4 color, F32 xpos) : mText(std::move(text)), mColor(std::move(color)), mXPosition(xpos) {}
 		public:
 			LLWString mText;
 			LLColor4  mColor;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 72ccf556b17ef3618ca4b9851228fe9fb4fa599b..66c1961dce1c8801e25bb620b85972905fa20274 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -453,7 +453,7 @@ BOOL LLTextEditor::replaceText(const std::string& search_text_in, const std::str
 	LLWString search_text = utf8str_to_wstring(search_text_in);
 	if (mIsSelecting)
 	{
-		LLWString text = getWText();
+		const LLWString& text = getWText();
 		LLWString selected_text = text.substr(mSelectionEnd, mSelectionStart - mSelectionEnd);
 
 		if (case_insensitive)
@@ -490,7 +490,7 @@ void LLTextEditor::replaceTextAll(const std::string& search_text, const std::str
 
 S32 LLTextEditor::prevWordPos(S32 cursorPos) const
 {
-	LLWString wtext(getWText());
+    const LLWString& wtext = getWText();
 	while( (cursorPos > 0) && (wtext[cursorPos-1] == ' ') )
 	{
 		cursorPos--;
@@ -504,7 +504,7 @@ S32 LLTextEditor::prevWordPos(S32 cursorPos) const
 
 S32 LLTextEditor::nextWordPos(S32 cursorPos) const
 {
-	LLWString wtext(getWText());
+	const LLWString& wtext = getWText();
 	while( (cursorPos < getLength()) && LLWStringUtil::isPartOfWord( wtext[cursorPos] ) )
 	{
 		cursorPos++;
@@ -569,7 +569,7 @@ BOOL LLTextEditor::selectionContainsLineBreaks()
 		S32 left = llmin(mSelectionStart, mSelectionEnd);
 		S32 right = left + llabs(mSelectionStart - mSelectionEnd);
 
-		LLWString wtext = getWText();
+		const LLWString& wtext = getWText();
 		for( S32 i = left; i < right; i++ )
 		{
 			if (wtext[i] == '\n')
@@ -606,7 +606,7 @@ S32 LLTextEditor::indentLine( S32 pos, S32 spaces )
 		// Unindent
 		for(S32 i=0; i < -spaces; i++)
 		{
-			LLWString wtext = getWText();
+            const LLWString& wtext = getWText();
 			if (wtext[pos] == ' ')
 			{
 				delta_spaces += remove( pos, 1, FALSE );
@@ -1836,7 +1836,7 @@ void LLTextEditor::unindentLineBeforeCloseBrace()
 {
 	if( mCursorPos >= 1 )
 	{
-		LLWString text = getWText();
+		const LLWString& text = getWText();
 		if( ' ' == text[ mCursorPos - 1 ] )
 		{
 			S32 line = getLineNumFromDocIndex(mCursorPos, false);
@@ -1985,7 +1985,7 @@ void LLTextEditor::doDelete()
 	{	
 		S32 i;
 		S32 chars_to_remove = 1;
-		LLWString text = getWText();
+		const LLWString& text = getWText();
 		if( (text[ mCursorPos ] == ' ') && (mCursorPos + SPACES_PER_TAB < getLength()) )
 		{
 			// Try to remove a full tab's worth of spaces
@@ -2231,7 +2231,7 @@ void LLTextEditor::drawPreeditMarker()
 		return;
 	}
 
-    const LLWString textString(getWText());
+    const LLWString& textString = getWText();
 	const llwchar *text = textString.c_str();
 	const S32 text_len = getLength();
 	const S32 num_lines = getLineCount();
@@ -2401,7 +2401,7 @@ void LLTextEditor::autoIndent()
 	S32 space_count = 0;
 	S32 i;
 
-	LLWString text = getWText();
+	const LLWString& text = getWText();
 	S32 offset = getLineOffsetFromDocIndex(mCursorPos);
 	while(( ' ' == text[line_start] ) && (space_count < offset))
 	{
@@ -2586,7 +2586,7 @@ BOOL LLTextEditor::tryToRevertToPristineState()
 
 void LLTextEditor::updateLinkSegments()
 {
-	LLWString wtext = getWText();
+	const LLWString& wtext = getWText();
 
 	// update any segments that contain a link
 	for (segment_set_t::iterator it = mSegments.begin(); it != mSegments.end(); ++it)
@@ -2959,7 +2959,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
 		current_line++;
 	}
 
-    const LLWString textString(getWText());
+    const LLWString& textString = getWText();
 	const llwchar * const text = textString.c_str();
 	const S32 line_height = mFont->getLineHeight();
 
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index 6b7d3bcab0d0f25d8473862943135b29908b75bd..1b1d6066269722d57a98b1192404aa2a1078eb98 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -115,19 +115,19 @@ BOOL	LLPanelVolume::postBuild()
         mSpinFriction->setValidateBeforeCommit(precommitValidate);
         mSpinFriction->setCommitCallback(std::bind(onCommitFlexible, std::placeholders::_1, this));
 
-        mSpinWind     = getChild<LLSpinCtrl>("FlexWind");
+        mSpinWind = getChild<LLSpinCtrl>("FlexWind");
         mSpinWind->setValidateBeforeCommit(precommitValidate);
         mSpinWind->setCommitCallback(std::bind(onCommitFlexible, std::placeholders::_1, this));
 
-        mSpinForceX   = getChild<LLSpinCtrl>("FlexForceX");
+        mSpinForceX = getChild<LLSpinCtrl>("FlexForceX");
         mSpinForceX->setValidateBeforeCommit(precommitValidate);
         mSpinForceX->setCommitCallback(std::bind(onCommitFlexible, std::placeholders::_1, this));
 
-        mSpinForceY   = getChild<LLSpinCtrl>("FlexForceY");
+        mSpinForceY = getChild<LLSpinCtrl>("FlexForceY");
         mSpinForceY->setValidateBeforeCommit(precommitValidate);
         mSpinForceY->setCommitCallback(std::bind(onCommitFlexible, std::placeholders::_1, this));
 
-        mSpinForceZ   = getChild<LLSpinCtrl>("FlexForceZ");
+        mSpinForceZ = getChild<LLSpinCtrl>("FlexForceZ");
         mSpinForceZ->setValidateBeforeCommit(precommitValidate);
         mSpinForceZ->setCommitCallback(std::bind(onCommitFlexible, std::placeholders::_1, this));
 	}
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index f1222d9b326f6053fa9cd672346ec5f25941fe12..4af0beea0f2dd46d210f521251552540242aaf65 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -981,9 +981,10 @@ std::string LLViewerTextEditor::getEmbeddedText()
 	// New version (Version 2)
 	mEmbeddedItemList->copyUsedCharsToIndexed();
 	LLWString outtextw;
-	for (S32 i=0; i<(S32)getWText().size(); i++)
+    const LLWString& wtext = getWText();
+    for (S32 i = 0; i < (S32) wtext.size(); i++)
 	{
-		llwchar wch = getWText()[i];
+        llwchar wch = wtext[i];
 		if( wch >= FIRST_EMBEDDED_CHAR && wch <= LAST_EMBEDDED_CHAR )
 		{
 			S32 index = mEmbeddedItemList->getIndexFromEmbeddedChar(wch);
@@ -1063,7 +1064,7 @@ void LLViewerTextEditor::onValueChange(S32 start, S32 end)
 
 void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end)
 {
-	LLWString text = getWText();
+	const LLWString& text = getWText();
 
 	// Start with i just after the first embedded item
 	for(S32 idx = start; idx < end; idx++ )