If you really care about performance, often you'll find that text-based solutions don't work for you. REST, however elegant and easily understandable, may turn out to be too slow for your needs. If that's the case, you should try to build your API around binary protocols. One of them, which is growing in popularity, is gRPC.
gRPC, as its name suggests, is an RPC system that was initially developed by Google. It uses HTTP/2 for transport, and Protocol Buffers as an Interface Description Language (IDL) for interoperability between multiple programming languages, and for data serialization. It's possible to use alternative technologies for this, for example, FlatBuffers. gRPC can be used both synchronously and in an asynchronous manner and allows creating both simple services and streaming ones.
Assuming you've decided to use protobufs, our Greeter service definition can look like this:
service Greeter {
rpc Greet(GreetRequest) returns (GreetResponse);
}
message...