zhangqiongyu commented on PR #2911:
URL: https://github.com/apache/brpc/pull/2911#issuecomment-2705404957

   ```
   const std::string& AdaptiveMaxConcurrency::UNLIMITED() {
       static const std::string s = "unlimited";
       return s;
   }
   
   const std::string& AdaptiveMaxConcurrency::CONSTANT() {
       static const std::string s = "constant";
       return s;
   }
   ```
   1.This way of initialization is much more common,uncontrolled use of global 
variables may cause dependency order problems(UB).
   2.These short strings can be optimized to be stored on the stack using the 
SSO(Small String Optimization) mechanism of std::string.
   3.The original lazy initialization mechanism is retained to reduce 
unnecessary memory usage.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to