PragmaTwice commented on PR #768:
URL: 
https://github.com/apache/incubator-kvrocks/pull/768#issuecomment-1204754432

   In fact, I think `StatusOr` is not only more expressive, but also performs 
better than `Status` in some cases, especially when template parameters are 
primitive types. 
   
   This is because `Status` is a large structure (`std::string` is usually 
larger than two words because SSO is generally used in the implementation of 
`std::string`, for example, the implementation of `std::string` in libstdc++ is 
32 bytes under 64 bits), so just `Status` is 40 bytes long, not including 
pointers for output. And Status inevitably constructs a `std::string` for any 
execution path.
   
   But `StatusOr` instance like `StatusOr<int>` is only 16 bytes long and does 
not initialize `std::string` when no error occurs, and it initializes the 
resulting integer directly in-place inside these 16 bytes.


-- 
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