perf: serialize a directory entry to and from one 128 byte buffer - #93
Merged
Merged
Conversation
A directory entry was written to the file field by field, in some forty small writes (one per UTF-16 unit of the name), and read the same way. Both now go through a 128 byte buffer in memory and touch the file once. Every stream creation and every stream length update writes an entry, so this shows up when a file has many streams.
francisdb
force-pushed
the
perf/direntry-serialization
branch
from
September 10, 2026 06:14
0badeae to
66e2877
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A directory entry was written to the file field by field, in about 45 small writes (one per UTF-16 unit of the name, then one per field), and read the same way. On an unbuffered
Fileeach of those is a syscall. Every stream creation writes at least two entries, and the balanced insert from #83 touches a few more, so this is what the create-heavy cases on disk spend their time on; opening a file reads every entry the same way.Both directions now go through a 128 byte buffer in memory and touch the file once. Measured against master with #83 merged:
Reading from disk, with the
read_streams_diskgroup from #94 (open the file, then read every stream):The large-stream cases are unchanged either way, as expected. For reference, 0.14.0 sat at 625 ms, 40 ms, 67 ms and 2.9 ms on the four disk write cases, so the two that #83 made slower on disk end up well ahead of the release.