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

[Annotated Buffers] Improve efficiency #7820

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

dbaileychess
Copy link
Collaborator

Changed the bulk of the text-based annnoted buffers to use a std::ofstream instead of building a giant std::string in memory and flushing the whole thing. It was easy to do since we build in file order.

Added --annotate-sparse-vector option which, when set, will exclude all but the first/last vector element:

Example:

vector (AnnotatedBinary.Foo.foobars):
  +0x00D4 | 03 00 00 00             | uint32_t   | 0x00000003 (3)                | length of vector (# items)
  +0x00D8 | 34 00 00 00             | UOffset32  | 0x00000034 (52) Loc: 0x010C   | offset to union[0] (`Bar`)
  <2 regions omitted>
  +0x00E0 | 04 00 00 00             | UOffset32  | 0x00000004 (4) Loc: 0x00E4    | offset to union[2] (`Bar`)

This will be useful when annotating giant files that are just vectors, where the contents don't really matter to the end user.

@github-actions github-actions bot added c++ codegen Involving generating code from schema labels Feb 7, 2023
@dbaileychess dbaileychess merged commit 535ead8 into google:master Feb 7, 2023
dbaileychess added a commit that referenced this pull request Mar 15, 2023
* AnnotatedBinaryTextGen switch to ofstream instead of building giant string

* Add --annotate-sparse-vectors to reduce AFB size
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ codegen Involving generating code from schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant