This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b014a0464 [Improve](doris::Status performance) fix the performance 
issue due to copy of std::string (#17411)
2b014a0464 is described below

commit 2b014a0464544ff8fc57ef405dbb7d688587bc82
Author: lihangyu <15605149...@163.com>
AuthorDate: Sat Mar 4 15:08:59 2023 +0800

    [Improve](doris::Status performance) fix the performance issue due to copy 
of std::string (#17411)
---
 be/src/common/status.h             | 2 +-
 be/src/service/backend_options.cpp | 2 +-
 be/src/service/backend_options.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/be/src/common/status.h b/be/src/common/status.h
index acb15eeb70..1a9bc9ae04 100644
--- a/be/src/common/status.h
+++ b/be/src/common/status.h
@@ -479,7 +479,7 @@ private:
 #endif
     };
     std::unique_ptr<ErrMsg> _err_msg;
-    std::string _be_ip = BackendOptions::get_localhost();
+    std::string_view _be_ip = BackendOptions::get_localhost();
 };
 
 inline std::ostream& operator<<(std::ostream& ostr, const Status& status) {
diff --git a/be/src/service/backend_options.cpp 
b/be/src/service/backend_options.cpp
index 5a431a2827..bad73b0c82 100644
--- a/be/src/service/backend_options.cpp
+++ b/be/src/service/backend_options.cpp
@@ -86,7 +86,7 @@ bool BackendOptions::init() {
     return true;
 }
 
-std::string BackendOptions::get_localhost() {
+const std::string& BackendOptions::get_localhost() {
     return _s_localhost;
 }
 
diff --git a/be/src/service/backend_options.h b/be/src/service/backend_options.h
index fc7c2ea5a4..5d28edbf12 100644
--- a/be/src/service/backend_options.h
+++ b/be/src/service/backend_options.h
@@ -29,7 +29,7 @@ class CIDR;
 class BackendOptions {
 public:
     static bool init();
-    static std::string get_localhost();
+    static const std::string& get_localhost();
     static bool is_bind_ipv6();
     static const char* get_service_bind_address();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to