protocolbuffers / protocolbuffers/protobuf
protobuf compiler in multiplatform project...
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
Hello,
I have multiplatfrom project which is using hundreds of .proto files.
Recently i realized that adding new .proto files increases wasm binary size by quite sensitive big size.
Investigated binary in the viewer, and found that each proto file have full proto fields text structure inside the binary. Which is unexpected, because i do not need text representation in my code at all.
It turns out protobuf compiler generates Message related proto classes, but there is option to use MessageLite instead.
But problem is it requires to include
option optimize_for = LITE_RUNTIME
to each .proto file, which isn't option for me bacause:
- There are too many .proto files and including this option manually will require significant amount of time!
- As i mentioned the project is multiplatform and includes host tools on windows platform which are used to compile proto graphs. Compiling of protographs require Message based compiled files, because of reflections capabilities.
So i expected some command line switch in proto compiler, so i can compile .proto to Message for host tools and to MessageLite in cross compile configs to reduce the size and to prevent my code from reverse engineering. But surprisingly there are no such command line exists.
Any reason for this?
I guess i will have to modify proto buf compiler code to include this option...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the protoc compiler entry points and the handling of .proto file options, then compare how Message and MessageLite output is selected. Verify whether a command-line setting can select the runtime for generated files without changing source schemas, while preserving reflection-capable host builds. Done means separate host and cross-compile invocations can produce the requested outputs and the behavior is covered by compiler tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100