Closed tmccombs closed 5 years ago
Also somewhat related. Code generation generates that creates new method descriptors each time a new ClientStub is created, rather than creating the method descriptors once and cloning the Arcs when additional clients are created.
Fixed in master
The definition of MethodDescriptor seems suboptimal to me. It is:
Note that name, req_marshaller, and resp_marshaller all use heap allocated memory. However, in almost all cases
name
could be a&'static str
, and in most cases the marshallers are justgrpc::marshaller::MarshallerProtobuf
(is there a case where this wouldn't be true?).I wonder if it would be better to have something like:
Then use
Arc<dyn MethodDescriptor<Req, Resp>>
in places that currently useArc<MethodDescriptor<Req, Resp>>
.Does that seem reasonable, or am I overlooking something?