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
Use Default Buffer Size of 8K Bytes #1112
Comments
@belugabehr Before making the change I'd want some numbers. General idea that matching to a disk block might be more efficient isn't super convincing. Java memory layout adds couple of extra bytes too so exact size of 0x2000 may not align any better. That is, while I'm not necessarily against different defaults, I'd want to know there is some actual measurable benefit; somehow to verify we are not changing things just based on vague feelings of them being sub-optimal. |
Yup. Fair enough. The idea though is not that it aligns with memory boundaries, but that it aligns with disk boundaries - reading two full sectors is 8192 bytes. Some discussion here: I noticed this while stepping through the Jackson code that it doesn't try to determine if the incoming |
On trying to determine buffering: problem is that JDK types do not really expose access to their internal buffers. On aligning to disk block size: due to buffering at various level (OS, hardware) anticipating optimal sizes is tricky. One possible way forward would be to make actual sizing more configurable so that developers who know their needs (for example preferring larger buffers when input size is known to be typically large) can tune their usage. |
Quick note: wrt changing of defaults, I'd accept benchmark runs that shows improvement on reading from |
Default buffer size is 8000 bytes which is not a power of 2. Update size to align with Java's default buffer size: 8192. The smaller buffers should be 2kb: 2048.
I've always heard that this number was chosen to be an multiple of disk sector size (4kb).
jackson-core/src/main/java/com/fasterxml/jackson/core/util/BufferRecycler.java
Line 80 in 02efa0a
The text was updated successfully, but these errors were encountered: