Skip to content
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

Excessive File Size in Generated Protobuf Files #234

Open
zhuiyi9009 opened this issue Mar 21, 2024 · 3 comments
Open

Excessive File Size in Generated Protobuf Files #234

zhuiyi9009 opened this issue Mar 21, 2024 · 3 comments

Comments

@zhuiyi9009
Copy link

I’ve noticed that the protobuf files generated by the tool are significantly large. Upon investigation, I found that each generated proto file redundantly includes the entire content of imported protos. As a result, this duplicated data is present in every single file, leading to bloated file sizes.

Expected Behavior: It would be more efficient if the imported protos were separately generated as standalone code, and other protos could reference them instead of duplicating the information within each file.

@tomas-abrahamsson
Copy link
Owner

Is your proto structure like this:

A.proto imports B.proto, C.proto, D.proto etc,
and you generate code for A, B, C and D?

You could then generate only A.proto. If you need messages from B, C or D, they are available via A.

@zhuiyi9009
Copy link
Author

thanks for reply.

My proto file includes common.proto, which is a file containing many structures. Other protocol files reference this file through import, resulting in all the generated files containing this information. As a result, the size of the generated files has become quite large

@tomas-abrahamsson
Copy link
Owner

The issue about large files has been up a few times before, so I might be taking a look at it, but it will likely take me some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants