Skip to content
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

Fix Incredibly Slow write Implementation of TmpFs In-Memory Files #3903

Closed
theduke opened this issue May 24, 2023 · 1 comment · Fixed by #4165
Closed

Fix Incredibly Slow write Implementation of TmpFs In-Memory Files #3903

theduke opened this issue May 24, 2023 · 1 comment · Fixed by #4165
Assignees
Labels
bug Something isn't working priority-medium Medium priority issue
Milestone

Comments

@theduke
Copy link
Contributor

theduke commented May 24, 2023

Currently writing to somewhere else than the end of a file always allocates a new buffer in the mem fs.
That will have ... horrible performance.

Need to fix this.

This is bad enough to call it a bug.

self.buffer.reserve_exact(buf.len());
let mut remainder = self.buffer.split_off(position as usize);
self.buffer.extend_from_slice(buf);
self.buffer.append(&mut remainder);

@theduke theduke added the bug Something isn't working label May 24, 2023
@theduke theduke self-assigned this May 24, 2023
theduke added a commit that referenced this issue May 24, 2023
The write() implementation for in-memory files used by the TmpFs /
mem_fs was terrible: it used to re-allocate and copy the whole data if
the write position was not at the end of the file.

This re-writes the implementation to grow the buffer in place if
required.

Also adds some tests.

Closes #3903
theduke added a commit that referenced this issue May 24, 2023
The write() implementation for in-memory files used by the TmpFs /
mem_fs was terrible: it used to re-allocate and copy the whole data if
the write position was not at the end of the file.

This re-writes the implementation to grow the buffer in place if
required.

Also adds some tests.

Closes #3903
theduke added a commit that referenced this issue May 24, 2023
The write() implementation for in-memory files used by the TmpFs /
mem_fs was terrible: it used to re-allocate and copy the whole data if
the write position was not at the end of the file.

This re-writes the implementation to grow the buffer in place if
required.

Also adds some tests.

Closes #3903
@ptitSeb ptitSeb added this to the v4.0 milestone May 30, 2023
@ptitSeb ptitSeb added the priority-medium Medium priority issue label May 30, 2023
@ptitSeb
Copy link
Contributor

ptitSeb commented May 30, 2023

Stretch goal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium Medium priority issue
Projects
None yet
3 participants