Light optimizations by passing reference to smart pointers around

Profiling shows that some smart pointers were unnecessarily created
here and there, and that had a noticeable effect on performance, when
comparing two gtk3 packages.

This patch passes references to smart pointers in those cases.

	* include/abg-fwd.h (get_type_name): Take a reference to type_sptr.
	* src/abg-ir.cc (get_type_name): Take a reference to type_sptr.
	(suppression_base::priv::{get_file_name_regex,
	get_file_name_not_regex, get_soname_regex, get_soname_not_regex}):
	Return a reference to regex_t_sptr.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2016-05-20 17:19:27 +02:00
parent a6ce923615
commit 22cd4059cd
3 changed files with 6 additions and 6 deletions

View File

@ -535,7 +535,7 @@ scope_decl*
get_type_scope(const shared_ptr<type_base>&);
interned_string
get_type_name(const shared_ptr<type_base>,
get_type_name(const shared_ptr<type_base>&,
bool qualified = true,
bool internal = false);

View File

@ -4762,7 +4762,7 @@ get_type_scope(const type_base_sptr& t)
/// @return a copy of the type name if the type has a name, or the
/// empty string if it does not.
interned_string
get_type_name(const type_base_sptr t, bool qualified, bool internal)
get_type_name(const type_base_sptr& t, bool qualified, bool internal)
{return get_type_name(t.get(), qualified, internal);}
/// Get the name of a given type and return a copy of it.

View File

@ -79,7 +79,7 @@ public:
///
/// If the 'file_name_regex' property of @ref suppression_base is
/// empty then this method returns nil.
const sptr_utils::regex_t_sptr
const sptr_utils::regex_t_sptr&
get_file_name_regex() const
{
if (!file_name_regex_)
@ -104,7 +104,7 @@ public:
///
/// If the 'file_name_not_regex' property of @ref suppression_base
/// is empty then this method returns nil.
const sptr_utils::regex_t_sptr
const sptr_utils::regex_t_sptr&
get_file_name_not_regex() const
{
if (!file_name_not_regex_)
@ -129,7 +129,7 @@ public:
///
/// If the 'soname_regex' property of @ref suppression_base is empty
/// then this method returns nil.
const sptr_utils::regex_t_sptr
const sptr_utils::regex_t_sptr&
get_soname_regex() const
{
if (!soname_regex_)
@ -154,7 +154,7 @@ public:
///
/// If the 'soname_not_regex' property of @ref suppression_base is
/// empty then this method returns nil.
const sptr_utils::regex_t_sptr
const sptr_utils::regex_t_sptr&
get_soname_not_regex() const
{
if (!soname_not_regex_)