You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While fixing #1286, I noticed that 8% of on-CPU time being spend doing
`memset` in `read_into` (see PR for flamegraph)
This is unnecessary work: the buffer has sufficient capacity, and we're
about to overwrite that region of the buffer.
In this PR, we switch to using `libc::pread` into the uninitialized
portion of the buffer, then manually set the length with `set_len`. Sure
enough, this removes the `memset` from the flamegraph.
Note that the new code is identical between `extent_inner_sqlite.rs` and
`extent_inner_raw.rs`, because they have the same data format; since
we're planning to remove SQLite in #1267 , I don't feel the need to
refactor into helper functions.
There's also a drive-by fix revealed by the new assertion: we need to
reattach the remaining `buf` to `out.data` (by calling `unsplit(..)`);
otherwise, it will force a reallocation. This will only trigger for
reads which span multiple extents, so it's probably not a big deal in
the wild, but let's do the correct thing instead of the wrong thing.
0 commit comments