Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

perf: optimize TRR writer with batched header writes#22

Merged
N283T merged 3 commits into
mainfrom
perf/optimize-trr-writer
Mar 23, 2026
Merged

perf: optimize TRR writer with batched header writes#22
N283T merged 3 commits into
mainfrom
perf/optimize-trr-writer

Conversation

@N283T

@N283T N283T commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Batch all 15 header fields into a single 84-byte buffer write (was 16 individual calls)
  • Increase writeFloatsBulk chunk size from 1024 to 4096 floats (16KB)
  • Flatten box matrix and write via writeFloatsBulk

These are incremental I/O optimizations. The TRR writer already achieves ~900 MB/s (read+write combined), which is ~4x faster than mdtraj's C reader. The bottleneck is now the read side, not the write side.

Test plan

  • All existing tests pass
  • Benchmarked: no regression in throughput

N283T added 3 commits March 23, 2026 14:38
…unks

- writeHeader: pack all 15 fields into a single 84-byte buffer and
  write in one call instead of 16 individual writeInt/writeFloat calls
- writeFloatsBulk: increase chunk size from 1024 to 4096 floats (16KB)
  to reduce write syscalls
- Box matrix: flatten to 1D array and write via writeFloatsBulk
…flicts

- Remove validation_test from main test step (was causing parallel
  file conflicts with the same tmp paths)
- Add separate `zig build validate` step in CI
- Validation tests still run in CI, just sequentially after unit tests
@N283T N283T merged commit de704e3 into main Mar 23, 2026
1 check passed
@N283T N283T deleted the perf/optimize-trr-writer branch March 23, 2026 05:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant