Skip to content

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
Co-authored-by: Derek Bailey <derekbailey@google.com>
jochenparm pushed a commit to jochenparm/flatbuffers that referenced this pull request Oct 29, 2024
Co-authored-by: Derek Bailey <derekbailey@google.com>
@razvanalex razvanalex deleted the py-clear-buffer branch July 3, 2025 13:44
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