Skip to content

Conversation

@jakobkordez
Copy link
Contributor

This PR refactors the problem of #6723 into a cleaner generated file.
All list fields in the unpack() functions get replaced from:

inventory: const fb.Uint8ListReader(lazy: false).vTableGetNullable(_bc, _bcOffset, 14),

to:

inventory: inventory?.toList(),

@github-actions github-actions bot added c++ codegen Involving generating code from schema dart labels Oct 31, 2025
@aardappel
Copy link
Collaborator

What does toList() do exactly? Is there any change in efficiency with the previous code?

@jakobkordez
Copy link
Contributor Author

toList iterates over all elements and creates a new List object. Should be even more efficient than the current implementation. This is because the current implementation re-reads all elements from the buffer, while my solution re-uses the cached ones (caching is done in _FbList)

@aardappel aardappel enabled auto-merge (squash) October 31, 2025 20:34
@aardappel aardappel disabled auto-merge October 31, 2025 20:41
@aardappel aardappel merged commit 592dc50 into google:master Oct 31, 2025
49 of 50 checks passed
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 dart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants