From 4c7a80181e2418cb1270d3fd14025c817d8abaf6 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 17 Oct 2020 17:57:21 -0400
Subject: [PATCH] Heavily optimize LLView and LLUICtrl with string_view to
 reduce string temporary generation

---
 indra/llui/llbadge.cpp              |  2 +-
 indra/llui/llbadge.h                |  2 +-
 indra/llui/llbutton.cpp             |  2 +-
 indra/llui/llbutton.h               |  2 +-
 indra/llui/llcheckboxctrl.cpp       |  2 +-
 indra/llui/llcheckboxctrl.h         |  2 +-
 indra/llui/llfloaterreglistener.cpp |  2 +-
 indra/llui/lllineeditor.cpp         |  2 +-
 indra/llui/lllineeditor.h           |  2 +-
 indra/llui/llmenugl.cpp             |  4 +-
 indra/llui/llmenugl.h               |  4 +-
 indra/llui/llpanel.cpp              | 48 ++++++++++++------------
 indra/llui/llpanel.h                | 58 ++++++++++++++---------------
 indra/llui/lltabcontainer.cpp       |  4 +-
 indra/llui/lltabcontainer.h         |  4 +-
 indra/llui/lltextbox.cpp            |  2 +-
 indra/llui/lltextbox.h              |  2 +-
 indra/llui/lltexteditor.cpp         |  2 +-
 indra/llui/lltexteditor.h           |  2 +-
 indra/llui/lluictrl.cpp             | 10 ++---
 indra/llui/lluictrl.h               |  2 +-
 indra/llui/llview.cpp               | 20 +++++-----
 indra/llui/llview.h                 | 28 +++++++-------
 indra/newview/llimview.cpp          |  4 +-
 24 files changed, 106 insertions(+), 106 deletions(-)

diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index ac05a6b0faf..96d1d9ff15d 100644
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -36,7 +36,7 @@ static LLDefaultChildRegistry::Register<LLBadge> r("badge");
 static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF;
 
 // Compiler optimization, generate extern template
-template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const;
+template class LLBadge* LLView::getChild<class LLBadge>(std::string_view name, BOOL recurse) const;
 
 
 LLBadge::Params::Params()
diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h
index 55f92e6e34a..4d2ab5b6c3f 100644
--- a/indra/llui/llbadge.h
+++ b/indra/llui/llbadge.h
@@ -171,7 +171,7 @@ class LLBadge
 
 // Build time optimization, generate once in .cpp file
 #ifndef LLBADGE_CPP
-extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const;
+extern template class LLBadge* LLView::getChild<class LLBadge>(std::string_view name, BOOL recurse) const;
 #endif
 
 #endif  // LL_LLBADGE_H
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index e2fb5ddb268..e97ac05af60 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -55,7 +55,7 @@ static LLDefaultChildRegistry::Register<LLButton> r("button");
 
 // Compiler optimization, generate extern template
 template class LLButton* LLView::getChild<class LLButton>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 // globals loaded from settings.xml
 S32	LLBUTTON_H_PAD	= 4;
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 4dfea852bb7..22517b5b4a6 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -395,7 +395,7 @@ class LLButton
 // Build time optimization, generate once in .cpp file
 #ifndef LLBUTTON_CPP
 extern template class LLButton* LLView::getChild<class LLButton>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif  // LL_LLBUTTON_H
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 6a51c4240b5..b1ab2857186 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -45,7 +45,7 @@ static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box");
 
 // Compiler optimization, generate extern template
 template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 void LLCheckBoxCtrl::WordWrap::declareValues()
 {
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index eb5bd5b6da5..2f0c4ade642 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -151,7 +151,7 @@ class LLCheckBoxCtrl
 // Build time optimization, generate once in .cpp file
 #ifndef LLCHECKBOXCTRL_CPP
 extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif  // LL_LLCHECKBOXCTRL_H
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 7525b8cab3a..741ed2ae0e9 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -131,7 +131,7 @@ void LLFloaterRegListener::clickButton(const LLSD& event) const
     {
         // Here 'floater' points to an LLFloater instance with the specified
         // name and key which isShown().
-        LLButton* button = floater->findChild<LLButton>(event["button"]);
+        LLButton* button = floater->findChild<LLButton>(event["button"].asString());
         if (! LLButton::isAvailable(button))
         {
             reply["type"]  = "LLButton";
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 63afd42ef15..06f4f24fe0d 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -74,7 +74,7 @@ static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor");
 
 // Compiler optimization, generate extern template
 template class LLLineEditor* LLView::getChild<class LLLineEditor>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 //
 // Member functions
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 902e52519b8..542cc0fddfb 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -451,7 +451,7 @@ class LLLineEditor
 // Build time optimization, generate once in .cpp file
 #ifndef LLLINEEDITOR_CPP
 extern template class LLLineEditor* LLView::getChild<class LLLineEditor>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif  // LL_LINEEDITOR_
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 0ae8bf6d895..629bd876d76 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -971,7 +971,7 @@ LLMenuItemBranchGL::~LLMenuItemBranchGL()
 
 
 // virtual
-LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse) const
+LLView* LLMenuItemBranchGL::getChildView(std::string_view name, BOOL recurse) const
 {
 	LLMenuGL* branch = getBranch();
 	if (branch)
@@ -988,7 +988,7 @@ LLView* LLMenuItemBranchGL::getChildView(const std::string& name, BOOL recurse)
 	return LLView::getChildView(name, recurse);
 }
 
-LLView* LLMenuItemBranchGL::findChildView(const std::string& name, BOOL recurse) const
+LLView* LLMenuItemBranchGL::findChildView(std::string_view name, BOOL recurse) const
 {
 	LLMenuGL* branch = getBranch();
 	if (branch)
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index e3378aad618..7bea51372bc 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -664,8 +664,8 @@ class LLMenuItemBranchGL : public LLMenuItemGL
 
 	virtual void openMenu();
 
-	virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const;
-	virtual LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const;
+	LLView* getChildView(std::string_view name, BOOL recurse = TRUE) const final;
+	LLView* findChildView(std::string_view name, BOOL recurse = TRUE) const final;
 
 private:
 	LLHandle<LLView> mBranchHandle;
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 817ac559280..9c4345d865a 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -55,7 +55,7 @@ LLPanel::factory_stack_t	LLPanel::sFactoryStack;
 
 // Compiler optimization, generate extern template
 template class LLPanel* LLView::getChild<class LLPanel>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 LLPanel::LocalizedString::LocalizedString()
 :	name("name"),
@@ -275,7 +275,7 @@ void LLPanel::setDefaultBtn(LLButton* btn)
 	}
 }
 
-void LLPanel::setDefaultBtn(const std::string& id)
+void LLPanel::setDefaultBtn(std::string_view id)
 {
 	LLButton *button = getChild<LLButton>(id);
 	if (button)
@@ -461,7 +461,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
 		it != p.strings.end();
 		++it)
 	{
-		mUIStrings[it->name] = it->value;
+		mUIStrings[it->name()] = it->value;
 	}
 
 	setLabel(p.label());
@@ -591,12 +591,12 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
 	return TRUE;
 }
 
-bool LLPanel::hasString(const std::string& name)
+bool LLPanel::hasString(std::string_view name)
 {
 	return mUIStrings.find(name) != mUIStrings.end();
 }
 
-std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const
+std::string LLPanel::getString(std::string_view name, const LLStringUtil::format_map_t& args) const
 {
 	ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
 	if (found_it != mUIStrings.end())
@@ -606,7 +606,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
 		formatted_string.setArgList(args);
 		return formatted_string.getString();
 	}
-	std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
+	std::string err_str = absl::StrCat("Failed to find string ", name, " in panel ", getName()); //*TODO: Translate
 	if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
 	{
 		LL_ERRS() << err_str << LL_ENDL;
@@ -618,14 +618,14 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
 	return LLStringUtil::null;
 }
 
-std::string LLPanel::getString(const std::string& name) const
+std::string LLPanel::getString(std::string_view name) const
 {
 	ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
 	if (found_it != mUIStrings.end())
 	{
 		return found_it->second;
 	}
-	std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
+	std::string err_str = absl::StrCat("Failed to find string ", name, " in panel ", getName()); //*TODO: Translate
 	if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
 	{
 		LL_ERRS() << err_str << LL_ENDL;
@@ -634,11 +634,11 @@ std::string LLPanel::getString(const std::string& name) const
 	{
 		LL_WARNS() << err_str << LL_ENDL;
 	}
-	return LLStringUtil::null;
+	return {};
 }
 
 
-void LLPanel::childSetVisible(const std::string& id, bool visible)
+void LLPanel::childSetVisible(std::string_view id, bool visible)
 {
 	LLView* child = findChild<LLView>(id);
 	if (child)
@@ -647,7 +647,7 @@ void LLPanel::childSetVisible(const std::string& id, bool visible)
 	}
 }
 
-void LLPanel::childSetEnabled(const std::string& id, bool enabled)
+void LLPanel::childSetEnabled(std::string_view id, bool enabled)
 {
 	LLView* child = findChild<LLView>(id);
 	if (child)
@@ -656,7 +656,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled)
 	}
 }
 
-void LLPanel::childSetFocus(const std::string& id, BOOL focus)
+void LLPanel::childSetFocus(std::string_view id, BOOL focus)
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -665,7 +665,7 @@ void LLPanel::childSetFocus(const std::string& id, BOOL focus)
 	}
 }
 
-BOOL LLPanel::childHasFocus(const std::string& id)
+BOOL LLPanel::childHasFocus(std::string_view id)
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -682,7 +682,7 @@ BOOL LLPanel::childHasFocus(const std::string& id)
 // Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
 // which takes a generic slot.  Or use mCommitCallbackRegistrar.add() with
 // a named callback and reference it in XML.
-void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
+void LLPanel::childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -691,7 +691,7 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
 	}
 }
 
-void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
+void LLPanel::childSetColor(std::string_view id, const LLColor4& color)
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -700,7 +700,7 @@ void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
 	}
 }
 
-LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const
+LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(std::string_view id) const
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -710,7 +710,7 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string&
 	return NULL;
 }
 
-LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const
+LLCtrlListInterface* LLPanel::childGetListInterface(std::string_view id) const
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -720,7 +720,7 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const
 	return NULL;
 }
 
-LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) const
+LLCtrlScrollInterface* LLPanel::childGetScrollInterface(std::string_view id) const
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -730,7 +730,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) c
 	return NULL;
 }
 
-void LLPanel::childSetValue(const std::string& id, LLSD value)
+void LLPanel::childSetValue(std::string_view id, LLSD value)
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -739,7 +739,7 @@ void LLPanel::childSetValue(const std::string& id, LLSD value)
 	}
 }
 
-LLSD LLPanel::childGetValue(const std::string& id) const
+LLSD LLPanel::childGetValue(std::string_view id) const
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -750,7 +750,7 @@ LLSD LLPanel::childGetValue(const std::string& id) const
 	return LLSD();
 }
 
-BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+BOOL LLPanel::childSetTextArg(std::string_view id, const std::string& key, const LLStringExplicit& text)
 {
 	LLUICtrl* child = findChild<LLUICtrl>(id);
 	if (child)
@@ -760,7 +760,7 @@ BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, con
 	return FALSE;
 }
 
-BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+BOOL LLPanel::childSetLabelArg(std::string_view id, const std::string& key, const LLStringExplicit& text)
 {
 	LLView* child = findChild<LLView>(id);
 	if (child)
@@ -770,7 +770,7 @@ BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, co
 	return FALSE;
 }
 
-void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
+void LLPanel::childSetAction(std::string_view id, const commit_signal_t::slot_type& function)
 {
 	LLButton* button = findChild<LLButton>(id);
 	if (button)
@@ -779,7 +779,7 @@ void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_
 	}
 }
 
-void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
+void LLPanel::childSetAction(std::string_view id, boost::function<void(void*)> function, void* value)
 {
 	LLButton* button = findChild<LLButton>(id);
 	if (button)
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 0a77f8e6299..e458a0cdba3 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -148,11 +148,11 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 	void			setBackgroundOpaque(BOOL b)		{ mBgOpaque = b; }
 	BOOL			isBackgroundOpaque() const { return mBgOpaque; }
 	void			setDefaultBtn(LLButton* btn = NULL);
-	void			setDefaultBtn(const std::string& id);
+	void			setDefaultBtn(std::string_view id);
 	void			updateDefaultBtn();
 	void			setLabel(const LLStringExplicit& label) { mLabel = label; }
 	std::string		getLabel() const { return mLabel; }
-	void			setHelpTopic(const std::string& help_topic) { mHelpTopic = help_topic; }
+	void			setHelpTopic(std::string help_topic) { mHelpTopic = std::move(help_topic); }
 	std::string		getHelpTopic() const { return mHelpTopic; }
 	
 	void			setCtrlsEnabled(BOOL b);
@@ -168,54 +168,54 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 	void initFromParams(const Params& p);
 	BOOL initPanelXML(	LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params);
 	
-	bool hasString(const std::string& name);
-	std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const;
-	std::string getString(const std::string& name) const;
+	bool hasString(std::string_view name);
+	std::string getString(std::string_view name, const LLStringUtil::format_map_t& args) const;
+	std::string getString(std::string_view name) const;
 
 	// ** Wrappers for setting child properties by name ** -TomY
 	// WARNING: These are deprecated, please use getChild<T>("name")->doStuff() idiom instead
 
 	// LLView
-	void childSetVisible(const std::string& name, bool visible);
+	void childSetVisible(std::string_view name, bool visible);
 
-	void childSetEnabled(const std::string& name, bool enabled);
-	void childEnable(const std::string& name)	{ childSetEnabled(name, true); }
-	void childDisable(const std::string& name) { childSetEnabled(name, false); };
+	void childSetEnabled(std::string_view name, bool enabled);
+	void childEnable(std::string_view name)	{ childSetEnabled(name, true); }
+	void childDisable(std::string_view name) { childSetEnabled(name, false); };
 
 	// LLUICtrl
-	void childSetFocus(const std::string& id, BOOL focus = TRUE);
-	BOOL childHasFocus(const std::string& id);
+	void childSetFocus(std::string_view id, BOOL focus = TRUE);
+	BOOL childHasFocus(std::string_view id);
 	
 	// *TODO: Deprecate; for backwards compatability only:
 	// Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
 	// which takes a generic slot.  Or use mCommitCallbackRegistrar.add() with
 	// a named callback and reference it in XML.
-	void childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data);	
-	void childSetColor(const std::string& id, const LLColor4& color);
+	void childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data);
+	void childSetColor(std::string_view id, const LLColor4& color);
 
-	LLCtrlSelectionInterface* childGetSelectionInterface(const std::string& id) const;
-	LLCtrlListInterface* childGetListInterface(const std::string& id) const;
-	LLCtrlScrollInterface* childGetScrollInterface(const std::string& id) const;
+	LLCtrlSelectionInterface* childGetSelectionInterface(std::string_view id) const;
+	LLCtrlListInterface* childGetListInterface(std::string_view id) const;
+	LLCtrlScrollInterface* childGetScrollInterface(std::string_view id) const;
 
 	// This is the magic bullet for data-driven UI
-	void childSetValue(const std::string& id, LLSD value);
-	LLSD childGetValue(const std::string& id) const;
+	void childSetValue(std::string_view id, LLSD value);
+	LLSD childGetValue(std::string_view id) const;
 
 	// For setting text / label replacement params, e.g. "Hello [NAME]"
 	// Not implemented for all types, defaults to noop, returns FALSE if not applicaple
-	BOOL childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text);
-	BOOL childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text);
+	BOOL childSetTextArg(std::string_view id, const std::string& key, const LLStringExplicit& text);
+	BOOL childSetLabelArg(std::string_view id, const std::string& key, const LLStringExplicit& text);
 	
 	// LLButton
-	void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value);
-	void childSetAction(const std::string& id, const commit_signal_t::slot_type& function);
+	void childSetAction(std::string_view id, boost::function<void(void*)> function, void* value);
+	void childSetAction(std::string_view id, const commit_signal_t::slot_type& function);
 
 	static LLView*	fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
 
 	//call onOpen to let panel know when it's about to be shown or activated
 	virtual void	onOpen(const LLSD& key) {}
 
-	void setXMLFilename(std::string filename) { mXMLFilename = filename; };
+	void setXMLFilename(std::string filename) { mXMLFilename = std::move(filename); };
 	std::string getXMLFilename() { return mXMLFilename; };
 	
 	boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb );
@@ -249,7 +249,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 	LLButton*		mDefaultBtn;
 	LLUIString		mLabel;
 
-	typedef std::map<std::string, std::string> ui_string_map_t;
+	typedef absl::node_hash_map<std::string, std::string> ui_string_map_t;
 	ui_string_map_t	mUIStrings;
 
 
@@ -258,7 +258,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder
 // Build time optimization, generate once in .cpp file
 #ifndef LLPANEL_CPP
 extern template class LLPanel* LLView::getChild<class LLPanel>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc;
@@ -271,12 +271,12 @@ class LLRegisterPanelClass final
 	LLSINGLETON_EMPTY_CTOR(LLRegisterPanelClass);
 public:
 	// register with either the provided builder, or the generic templated builder
-	void addPanelClass(const std::string& tag,LLPanelClassCreatorFunc func)
+	void addPanelClass(std::string tag, LLPanelClassCreatorFunc func)
 	{
-		mPanelClassesNames[tag] = func;
+		mPanelClassesNames.insert_or_assign(std::move(tag), std::move(func));
 	}
 
-	LLPanel* createPanelClass(const std::string& tag)
+	LLPanel* createPanelClass(const std::string_view tag)
 	{
 		param_name_map_t::iterator iT =  mPanelClassesNames.find(tag);
 		if(iT == mPanelClassesNames.end())
@@ -291,7 +291,7 @@ class LLRegisterPanelClass final
 	}
 
 private:
-	typedef std::map< std::string, LLPanelClassCreatorFunc> param_name_map_t;
+	typedef std::map< std::string, LLPanelClassCreatorFunc, std::less<>> param_name_map_t;
 	
 	param_name_map_t mPanelClassesNames;
 };
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 3b166f261dc..44f33801fc3 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -312,7 +312,7 @@ void LLTabContainer::reshape(S32 width, S32 height, BOOL called_from_parent)
 }
 
 //virtual
-LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) const
+LLView* LLTabContainer::getChildView(std::string_view name, BOOL recurse) const
 {
 	tuple_list_t::const_iterator itor;
 	for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
@@ -340,7 +340,7 @@ LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse) cons
 }
 
 //virtual
-LLView* LLTabContainer::findChildView(const std::string& name, BOOL recurse) const
+LLView* LLTabContainer::findChildView(std::string_view name, BOOL recurse) const
 {
 	tuple_list_t::const_iterator itor;
 	for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 8f8cedb1b96..94d7b02a64b 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -147,8 +147,8 @@ class LLTabContainer : public LLPanel
 	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,	BOOL drop,
 									   EDragAndDropType type, void* cargo_data,
 									   EAcceptance* accept, std::string& tooltip);
-	/*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const;
-	/*virtual*/ LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const;
+	/*virtual*/ LLView* getChildView(std::string_view name, BOOL recurse = TRUE) const final;
+	/*virtual*/ LLView* findChildView(std::string_view name, BOOL recurse = TRUE) const final;
 	/*virtual*/ void initFromParams(const LLPanel::Params& p);
 	/*virtual*/ bool addChild(LLView* view, S32 tab_group = 0);
 	/*virtual*/ BOOL postBuild();
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 0afd32f3327..3ceeb23dd3a 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -39,7 +39,7 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text");
 
 // Compiler optimization, generate extern template
 template class LLTextBox* LLView::getChild<class LLTextBox>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 LLTextBox::LLTextBox(const LLTextBox::Params& p)
 :	LLTextBase(p),
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 061d2dd23db..dd7a3aff39a 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -81,7 +81,7 @@ class LLTextBox :
 // Build time optimization, generate once in .cpp file
 #ifndef LLTEXTBOX_CPP
 extern template class LLTextBox* LLView::getChild<class LLTextBox>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index dc3353f42ce..a09192dbb6b 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -70,7 +70,7 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor");
 
 // Compiler optimization, generate extern template
 template class LLTextEditor* LLView::getChild<class LLTextEditor>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 //
 // Constants
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 5e9e1a27cda..c996658d93f 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -335,7 +335,7 @@ class LLTextEditor :
 // Build time optimization, generate once in .cpp file
 #ifndef LLTEXTEDITOR_CPP
 extern template class LLTextEditor* LLView::getChild<class LLTextEditor>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif  // LL_TEXTEDITOR_H
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 31107bf4752..1d9f0b75cde 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -43,7 +43,7 @@ F32 LLUICtrl::sInactiveControlTransparency = 1.0f;
 
 // Compiler optimization, generate extern template
 template class LLUICtrl* LLView::getChild<class LLUICtrl>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 LLUICtrl::CallbackParam::CallbackParam()
 :	name("name"),
@@ -135,7 +135,7 @@ void LLUICtrl::initFromParams(const Params& p)
 	{
 		if (p.enabled_controls.enabled.isChosen())
 		{
-			LLControlVariable* control = findControl(p.enabled_controls.enabled);
+			LLControlVariable* control = findControl(p.enabled_controls.enabled());
 			if (control)
 			{
 				setEnabledControlVariable(control);
@@ -149,7 +149,7 @@ void LLUICtrl::initFromParams(const Params& p)
 		}
 		else if(p.enabled_controls.disabled.isChosen())
 		{
-			LLControlVariable* control = findControl(p.enabled_controls.disabled);
+			LLControlVariable* control = findControl(p.enabled_controls.disabled());
 			if (control)
 			{
 				setDisabledControlVariable(control);
@@ -166,7 +166,7 @@ void LLUICtrl::initFromParams(const Params& p)
 	{
 		if (p.controls_visibility.visible.isChosen())
 		{
-			LLControlVariable* control = findControl(p.controls_visibility.visible);
+			LLControlVariable* control = findControl(p.controls_visibility.visible());
 			if (control)
 			{
 				setMakeVisibleControlVariable(control);
@@ -180,7 +180,7 @@ void LLUICtrl::initFromParams(const Params& p)
 		}
 		else if (p.controls_visibility.invisible.isChosen())
 		{
-			LLControlVariable* control = findControl(p.controls_visibility.invisible);
+			LLControlVariable* control = findControl(p.controls_visibility.invisible());
 			if (control)
 			{
 				setMakeInvisibleControlVariable(control);
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 3cca281f1ca..cba737eb81a 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -328,7 +328,7 @@ class LLUICtrl
 // Build time optimization, generate once in .cpp file
 #ifndef LLUICTRL_CPP
 extern template class LLUICtrl* LLView::getChild<class LLUICtrl>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif  // LL_LLUICTRL_H
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 4e1b98fc7e3..2574f6dcbc1 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -84,7 +84,7 @@ BOOL LLView::sIsDrawing = FALSE;
 
 // Compiler optimization, generate extern template
 template class LLView* LLView::getChild<class LLView>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 
 static LLDefaultChildRegistry::Register<LLView> r("view");
 
@@ -718,7 +718,7 @@ void LLView::logMouseEvent()
 }
 
 template <typename METHOD, typename CHARTYPE>
-LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method,
+LLView* LLView::childrenHandleCharEvent(std::string_view desc, const METHOD& method,
 										CHARTYPE c, MASK mask)
 {
 	if ( getVisible() && getEnabled() )
@@ -1574,7 +1574,7 @@ BOOL LLView::hasAncestor(const LLView* parentp) const
 
 //-----------------------------------------------------------------------------
 
-BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const
+BOOL LLView::childHasKeyboardFocus(std::string_view childname) const
 {
 	LLView *focus = dynamic_cast<LLView *>(gFocusMgr.getKeyboardFocus());
 	
@@ -1593,7 +1593,7 @@ BOOL LLView::childHasKeyboardFocus( const std::string& childname ) const
 
 //-----------------------------------------------------------------------------
 
-BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const
+BOOL LLView::hasChild(std::string_view childname, BOOL recurse) const
 {
 	return findChildView(childname, recurse) != NULL;
 }
@@ -1601,14 +1601,14 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const
 //-----------------------------------------------------------------------------
 // getChildView()
 //-----------------------------------------------------------------------------
-LLView* LLView::getChildView(const std::string& name, BOOL recurse) const
+LLView* LLView::getChildView(std::string_view name, BOOL recurse) const
 {
 	return getChild<LLView>(name, recurse);
 }
 
 static LLTrace::BlockTimerStatHandle FTM_FIND_VIEWS("Find Widgets");
 
-LLView* LLView::findChildView(const std::string& name, BOOL recurse) const
+LLView* LLView::findChildView(std::string_view name, BOOL recurse) const
 {
 	LL_RECORD_BLOCK_TIME(FTM_FIND_VIEWS);
 	//richard: should we allow empty names?
@@ -2265,13 +2265,13 @@ LLView*	LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
 //-----------------------------------------------------------------------------
 
 
-LLControlVariable *LLView::findControl(const std::string& name)
+LLControlVariable *LLView::findControl(std::string_view name)
 {
 	// parse the name to locate which group it belongs to
-	std::size_t key_pos= name.find(".");
-	if(key_pos!=  std::string::npos )
+	std::size_t key_pos = name.find('.');
+	if(key_pos !=  std::string::npos )
 	{
-		std::string control_group_key = name.substr(0, key_pos);
+		std::string control_group_key(name.substr(0, key_pos));
 		LLControlVariable* control;
 		// check if it's in the control group that name indicated
 		if(LLUI::getInstance()->mSettingGroups[control_group_key])
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index c60dcf3344f..499df896a64 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -238,7 +238,7 @@ class LLView
 	void		setFollowsAll()					{ mReshapeFlags |= FOLLOWS_ALL; }
 
 	void        setSoundFlags(U8 flags)			{ mSoundFlags = flags; }
-	void		setName(std::string name)			{ mName = name; }
+	void		setName(std::string name)			{ mName = std::move(name); }
 	void		setUseBoundingRect( BOOL use_bounding_rect );
 	BOOL		getUseBoundingRect() const;
 
@@ -338,8 +338,8 @@ class LLView
 	S32			getChildCount()	const			{ return (S32)mChildList.size(); }
 	template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); }
 	BOOL		hasAncestor(const LLView* parentp) const;
-	BOOL		hasChild(const std::string& childname, BOOL recurse = FALSE) const;
-	BOOL 		childHasKeyboardFocus( const std::string& childname ) const;
+	BOOL		hasChild(std::string_view childname, BOOL recurse = FALSE) const;
+	BOOL 		childHasKeyboardFocus(std::string_view childname ) const;
 	
 	// these iterators are used for collapsing various tree traversals into for loops
 	typedef LLTreeDFSIter<LLView, child_list_const_iter_t> tree_iterator_t;
@@ -412,7 +412,7 @@ class LLView
 	void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
 	void localRectToScreen( const LLRect& local, LLRect* screen ) const;
 	
-	LLControlVariable *findControl(const std::string& name);
+	LLControlVariable *findControl(std::string_view name);
 
 	const child_list_t*	getChildList() const { return &mChildList; }
 	child_list_const_iter_t	beginChild() const { return mChildList.begin(); }
@@ -448,24 +448,24 @@ class LLView
 	// static method handles NULL pointer too
 	static std::string getPathname(const LLView*);
 
-	template <class T> T* findChild(const std::string& name, BOOL recurse = TRUE) const
+	template <class T> T* findChild(std::string_view name, BOOL recurse = TRUE) const
 	{
 		LLView* child = findChildView(name, recurse);
 		T* result = dynamic_cast<T*>(child);
 		return result;
 	}
 
-	template <class T> T* getChild(const std::string& name, BOOL recurse = TRUE) const;
+	template <class T> T* getChild(std::string_view name, BOOL recurse = TRUE) const;
 
-	template <class T> T& getChildRef(const std::string& name, BOOL recurse = TRUE) const
+	template <class T> T& getChildRef(std::string_view name, BOOL recurse = TRUE) const
 	{
 		return *getChild<T>(name, recurse);
 	}
 
-	virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE) const;
-	virtual LLView* findChildView(const std::string& name, BOOL recurse = TRUE) const;
+	virtual LLView* getChildView(std::string_view name, BOOL recurse = TRUE) const;
+	virtual LLView* findChildView(std::string_view name, BOOL recurse = TRUE) const;
 
-	template <class T> T* getDefaultWidget(const std::string& name) const
+	template <class T> T* getDefaultWidget(std::string_view name) const
 	{
 		LLView* widgetp = getDefaultWidgetContainer().findChildView(name);
 		return dynamic_cast<T*>(widgetp);
@@ -572,7 +572,7 @@ class LLView
 	LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block = true);
 
 	template <typename METHOD, typename CHARTYPE>
-	LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method,
+	LLView* childrenHandleCharEvent(std::string_view desc, const METHOD& method,
 									CHARTYPE c, MASK mask);
 
 	// adapter to blur distinction between handleKey() and handleUnicodeChar()
@@ -686,7 +686,7 @@ struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<L
 };
 }
 
-template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) const
+template <class T> T* LLView::getChild(std::string_view name, BOOL recurse) const
 {
 	LLView* child = findChildView(name, recurse);
 	T* result = dynamic_cast<T*>(child);
@@ -700,7 +700,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
 		result = getDefaultWidget<T>(name);
 		if (!result)
 		{
-			result = LLUICtrlFactory::getDefaultWidget<T>(name);
+			result = LLUICtrlFactory::getDefaultWidget<T>(std::string(name));
 
 			if (result)
 			{
@@ -725,7 +725,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
 // require explicit specialization.  See llbutton.cpp for an example.
 #ifndef LLVIEW_CPP
 extern template class LLView* LLView::getChild<class LLView>(
-	const std::string& name, BOOL recurse) const;
+	std::string_view name, BOOL recurse) const;
 #endif
 
 #endif //LL_LLVIEW_H
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index e22cc184613..82e26499ee8 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2305,12 +2305,12 @@ BOOL LLIncomingCallDialog::postBuild()
 		if (gAgent.getGroupData(session_id, data))
 		{
 			args["[GROUP]"] = data.mName;
-			call_type = getString(mPayload["notify_box_type"], args);
+			call_type = getString(mPayload["notify_box_type"].asStringRef(), args);
 		}
 	}
 	else
 	{
-		call_type = getString(mPayload["notify_box_type"]);
+		call_type = getString(mPayload["notify_box_type"].asStringRef());
 	}
 		
 	
-- 
GitLab