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

[Python] Add clear method for builder reuse #8186

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

razvanalex
Copy link
Contributor

This PR addresses an old issue (#283) that, in python, the buffer must be recreated every time. Adding a reset method which keeps the internal buffer allocated and resets the internal state provides some performance uplifts. Added a benchmark and here is the result:

built 100 512-byte flatbuffers in 0.01sec: 6892.37/sec, 3.37MB/sec
built 100 512-byte flatbuffers (reused buffer) in 0.01sec: 10673.90/sec, 5.21MB/sec

@dbaileychess dbaileychess merged commit d47cd10 into google:master Dec 18, 2023
@dbaileychess
Copy link
Collaborator

Sorry for the delay, had some unrelated CI issues.

@razvanalex
Copy link
Contributor Author

No worries, thanks for merging!

jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants