-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
about support protobuf arena #1175
Conversation
赞,好奇有多少的性能提升? |
大包看起来效果不错,方便看下不同包大小的场景下(比如16B,32B,64B,128B,256B,512B...)的性能差异么,这些包更典型些 |
好,我补充下这块的数据 |
|
||
template<class T> | ||
struct ArenaObjDeleter { | ||
constexpr ArenaObjDeleter() noexcept = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么不把这个 mark 成 delete 呢?
del(!cntl->get_memory_arena()->OwnObject()); | ||
std::unique_ptr<const google::protobuf::Message, | ||
butil::ArenaObjDeleter<const google::protobuf::Message> | ||
> recycle_req(req, del); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种indent方式有些怪,可以统一成下面这样吗
std::unique_ptr<google::protobuf::Message,
butil::ArenaObjDeleter<google::protobuf::Message>> req;
std::unique_ptr<google::protobuf::Message,
butil::ArenaObjDeleter<google::protobuf::Message>> res;
} | ||
return _arena; | ||
} | ||
void share_memory_arena(Controller *cntl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为保持和现有代码风格一致,引用和指针符号统一对齐到左边与类型挨着吧
|
||
void operator()(T *ptr) const { | ||
if (_own_obj) { | ||
VLOG(199) << "delete!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VLOG(RPC_VLOG_LEVEL)
> | ||
CreateMessage(const google::protobuf::Message &proto_type) { | ||
google::protobuf::Message *msg = proto_type.New(); | ||
VLOG(199) << __FUNCTION__; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FUNCTION 是哪里定义的宏,用__func__变量会更标准些吧
请问这个pr没合入是还存在什么问题么? |
现在可以使用 #2718 中提供的功能,通过自定义RpcPBMessageFactory来支持arena |
@limindlmu 可以看看#2751 。 |
Closed this as completed #2751 . |
#535
麻烦看下这个实现是否可以被接受,当前先只改了baidu rpc protocol。