Excessive syscalls when using BufWriter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 853
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
I am writing to a BufWriter<File>. Unfortunately, std::io::BufWriter::stream_position falls back to running a seek syscall to figure out the current stream position. This makes my serialization workload take ~300x longer than necessary.
As a workaround, NoSeek<BufWriter<File>> works for my usecase. In fact, the values returned by stream_position are never used by the generated code. Emitting them only when necessary should improve the performance in many cases.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing generated serialization code that calls std::io::BufWriter::stream_position and compare it with the NoSeek<BufWriter> workaround described in the issue. Determine when those position values are needed; done means unnecessary stream_position calls are omitted and the serialization workload no longer performs the avoidable seek syscalls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100