All callers really pass a C string literal, and declaring a
`std::string` parameter will implicitly create two `std::string`
instances: one on the caller's stack, and another one inside write()
as parameter to the continuation lambda. This causes considerable and
unnecessary overhead.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
}
template <class F>
-CtPtr ProtocolV2::write(const std::string &desc,
+CtPtr ProtocolV2::write(std::string_view desc,
CONTINUATION_TYPE<ProtocolV2> &next,
F &frame) {
ceph::bufferlist bl;
return write(desc, next, bl);
}
-CtPtr ProtocolV2::write(const std::string &desc,
+CtPtr ProtocolV2::write(std::string_view desc,
CONTINUATION_TYPE<ProtocolV2> &next,
ceph::bufferlist &buffer) {
if (unlikely(pre_auth.enabled)) {
Ct<ProtocolV2> *read(CONTINUATION_RXBPTR_TYPE<ProtocolV2> &next,
rx_buffer_t&& buffer);
template <class F>
- Ct<ProtocolV2> *write(const std::string &desc,
+ Ct<ProtocolV2> *write(std::string_view desc,
CONTINUATION_TYPE<ProtocolV2> &next,
F &frame);
- Ct<ProtocolV2> *write(const std::string &desc,
+ Ct<ProtocolV2> *write(std::string_view desc,
CONTINUATION_TYPE<ProtocolV2> &next,
ceph::bufferlist &buffer);