Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between protoc and protobuf (Protocol Buffer)

Can some clarify difference between protocol buffer and protoc ?. Googling only shows protocol buffers. I see that naming convention is different for both protobuf-programming language-version and protoc-operating system-86_32. Are they different or same ?

Do i need to install both while working with tensorflow ? Although

protoc --version

is 3.6 but my pip is complaining

tensorflow-gpu 1.7.0 has requirement protobuf>=3.4.0, but you'll have protobuf 2.6.1 which is incompatible.
like image 627
BhanuKiran Avatar asked Aug 16 '18 06:08

BhanuKiran


People also ask

What does protoc compiler do?

Google provides a compiler called protoc which can produce output for C++, Java or Python. Other schema compilers are available from other sources to create language-dependent output for over 20 other languages.

What is protocol buffer in gRPC?

Protocol buffers are a combination of the definition language (created in . proto files), the code that the proto compiler generates to interface with data, language-specific runtime libraries, and the serialization format for data that is written to a file (or sent across a network connection).

What is faster than Protobuf?

TL;DR — encoding and decoding string-intensive data in JavaScript is faster with JSON than it is with protobuf. When you have structured data in JavaScript, which needs to be sent over the network (for another microservice for example) or saved into a storage system, it first needs to be serialized.

Is Protobuf a protocol?

Protocol buffers, usually referred as Protobuf, is a protocol developed by Google to allow serialization and deserialization of structured data. Google developed it with the goal to provide a better way, compared to XML, to make systems communicate.


1 Answers

"protobuf" or "protocol buffers" is the name of a serialization format and/or associated tooling.

protoc is a specific protobuf tool, specifically Google's implementation of a ".proto" parser and code generator (and a few other things)

".proto" is a schema DSL used for describing the messages you plan to use in your application - it is text based.

The usual process is:

  1. write or obtain a .proto for your messages
  2. run the .proto through protoc or any other library-specific generator tool to obtain the message types for your target platform
  3. add those generated message types to your application
  4. import / reference the protobuf library that matches your chosen tooling / platform
  5. build

Some tools work the other way around, working from your own types in your platform (the "code first" rather than "contract first" approach)

like image 161
Marc Gravell Avatar answered Sep 28 '22 09:09

Marc Gravell