tisonkun commented on code in PR #643:
URL: https://github.com/apache/incubator-kvrocks/pull/643#discussion_r902348261


##########
src/status.h:
##########
@@ -57,13 +57,18 @@ class Status {
     NetSendErr,
   };
 
-  Status() : Status(cOK, "ok") {}
-  explicit Status(Code code, std::string msg = "") : code_(code), 
msg_(std::move(msg)) {}
+  Status() : Status(cOK) {}
+  explicit Status(Code code, std::string msg = {}) : code_(code), 
msg_(std::move(msg)) {}
   bool IsOK() { return code_ == cOK; }
   bool IsNotFound() { return code_ == NotFound; }
   bool IsImorting() { return code_ == SlotImport; }
-  std::string Msg() { return msg_; }
-  static Status OK() { return Status(cOK, "ok"); }
+  std::string Msg() {
+    if (IsOK()) {
+      return "ok";
+    }
+    return msg_;

Review Comment:
   Will this change cause branch prediction overhead and affect efficiency 
which we'd like to improve in this PR? It seems not a net win.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to