Skip to content

Use buffers in filesystem read APIs #2707

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

Open
TheBlueMatt opened this issue Nov 4, 2023 · 0 comments
Open

Use buffers in filesystem read APIs #2707

TheBlueMatt opened this issue Nov 4, 2023 · 0 comments
Assignees
Labels
Take a Friday Leave a Friday Stomp the Bugs, Without Much Commitment

Comments

@TheBlueMatt
Copy link
Collaborator

After handling #2706 locally, 44% of my allocations locally are from path building when using the MonitorUpdatingPersister! That's obviously nuts, and luckily we can cut this down with careful buffer management:

  • MonitorName has an obvious maximum size, so should be a fixed length buffer with a length field.
  • Similarly, we realloc a ton when building paths with the PathBuf abstraction. Because they're super short, we should be storing them on the stack in constant-size buffers, though sadly its a bit more involved because on Unix its all bytes and on Windows its all u16s. IMO we should just use with_capacity on Windows, but on Unix we should use fixed-length buffers and make it a path with https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStrExt.html#tymethod.from_bytes (internet claims max path len is only 4096 bytes, so this should be easy).
@TheBlueMatt TheBlueMatt added this to the 0.0.119 milestone Nov 4, 2023
@TheBlueMatt TheBlueMatt modified the milestones: 0.0.119, 0.0.120 Dec 8, 2023
@TheBlueMatt TheBlueMatt modified the milestones: 0.0.120 , 0.0.121 Jan 9, 2024
@TheBlueMatt TheBlueMatt modified the milestones: 0.0.122, 0.0.123 Mar 18, 2024
@TheBlueMatt TheBlueMatt added the Take a Friday Leave a Friday Stomp the Bugs, Without Much Commitment label May 6, 2024
@TheBlueMatt TheBlueMatt removed this from the 0.0.124 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Take a Friday Leave a Friday Stomp the Bugs, Without Much Commitment
Projects
None yet
Development

No branches or pull requests

2 participants