Skip to content

Cache x86 checksum SIMD feature detection#1929

Merged
oferchen merged 1 commit into
masterfrom
implement-missing-components-for-rsync-parity
Nov 4, 2025
Merged

Cache x86 checksum SIMD feature detection#1929
oferchen merged 1 commit into
masterfrom
implement-missing-components-for-rsync-parity

Conversation

@oferchen
Copy link
Copy Markdown
Owner

@oferchen oferchen commented Nov 4, 2025

Summary

  • cache the x86 rolling checksum SIMD feature detection results so repeated weak checksum updates avoid redundant CPU queries
  • document the caching requirement for checksum hot paths in internal docs and cover the behaviour with a dedicated unit test

Testing

  • cargo test -p rsync-checksums

https://chatgpt.com/codex/tasks/task_e_6909a6b5de688323843bbbc8d20f9db6

@oferchen oferchen merged commit 1892226 into master Nov 4, 2025
@oferchen oferchen deleted the implement-missing-components-for-rsync-parity branch November 4, 2025 07:21
oferchen added a commit that referenced this pull request May 4, 2026
…dling (#1929, #1930) (#3608)

* fix(fast_io): IOCP writer_from_file overlapped flag + typed error handling (#1929, #1930)

#1929: IOCP writer_from_file now correctly handles std::fs::File handles
that lack FILE_FLAG_OVERLAPPED. Under IocpPolicy::Enabled the path is
recovered via GetFinalPathNameByHandleW, the original handle is dropped,
and the file is reopened through IocpWriter::create_for_append with
FILE_FLAG_OVERLAPPED. Anonymous handles (pipes, unnamed temp files) are
rejected with a clear ErrorKind::Unsupported message that names the
underlying FILE_FLAG_OVERLAPPED requirement. IocpPolicy::Auto silently
falls back to standard buffered I/O on any failure.

#1930: Two Win32 error codes are now mapped to typed IocpError variants:
- ERROR_INVALID_PARAMETER (87) -> IocpError::InvalidOperation, returned
  by WriteFile/ReadFile/GetQueuedCompletionStatus(Ex) call sites in the
  file reader, file writer, and completion pump. Maps to
  io::ErrorKind::InvalidInput.
- ERROR_INSUFFICIENT_BUFFER (122) -> IocpError::InsufficientBuffer.
  The pump drain loop transparently doubles its OVERLAPPED_ENTRY buffer
  (capped at 8192 entries / 256 KiB) and retries, only surfacing the
  typed error if the cap is reached. Maps to io::ErrorKind::OutOfMemory.

Both variants implement From<IocpError> for io::Error, so existing
io::Result-returning APIs remain backwards compatible. Cross-platform
stub mirrors the type for compile parity.

Tests added (Windows-gated):
- writer_from_file_enabled_reopens_with_overlapped: real file handle
  reopened as Iocp variant, content writes succeed.
- writer_from_file_enabled_rejects_anonymous_handle: CreatePipe handle
  yields ErrorKind::Unsupported with FILE_FLAG_OVERLAPPED in the message.
- writer_from_file_auto_falls_back_for_anonymous_handle: Auto policy
  never errors on a regular file (Iocp or Std both acceptable).
- pump_drains_burst_larger_than_batch_size: 4x batch-size completion
  burst dispatches without loss, exercising the dynamic-growth path.
- iocp_error_insufficient_buffer_round_trips: typed variant maps to
  OutOfMemory and preserves request/capacity in the message.
- error.rs: 6 unit tests covering both variants, code recognition
  helpers, and classify_overlapped_error pass-through.

* style: cargo fmt --all
oferchen added a commit that referenced this pull request May 5, 2026
…dling (#1929, #1930) (#3608)

* fix(fast_io): IOCP writer_from_file overlapped flag + typed error handling (#1929, #1930)

#1929: IOCP writer_from_file now correctly handles std::fs::File handles
that lack FILE_FLAG_OVERLAPPED. Under IocpPolicy::Enabled the path is
recovered via GetFinalPathNameByHandleW, the original handle is dropped,
and the file is reopened through IocpWriter::create_for_append with
FILE_FLAG_OVERLAPPED. Anonymous handles (pipes, unnamed temp files) are
rejected with a clear ErrorKind::Unsupported message that names the
underlying FILE_FLAG_OVERLAPPED requirement. IocpPolicy::Auto silently
falls back to standard buffered I/O on any failure.

#1930: Two Win32 error codes are now mapped to typed IocpError variants:
- ERROR_INVALID_PARAMETER (87) -> IocpError::InvalidOperation, returned
  by WriteFile/ReadFile/GetQueuedCompletionStatus(Ex) call sites in the
  file reader, file writer, and completion pump. Maps to
  io::ErrorKind::InvalidInput.
- ERROR_INSUFFICIENT_BUFFER (122) -> IocpError::InsufficientBuffer.
  The pump drain loop transparently doubles its OVERLAPPED_ENTRY buffer
  (capped at 8192 entries / 256 KiB) and retries, only surfacing the
  typed error if the cap is reached. Maps to io::ErrorKind::OutOfMemory.

Both variants implement From<IocpError> for io::Error, so existing
io::Result-returning APIs remain backwards compatible. Cross-platform
stub mirrors the type for compile parity.

Tests added (Windows-gated):
- writer_from_file_enabled_reopens_with_overlapped: real file handle
  reopened as Iocp variant, content writes succeed.
- writer_from_file_enabled_rejects_anonymous_handle: CreatePipe handle
  yields ErrorKind::Unsupported with FILE_FLAG_OVERLAPPED in the message.
- writer_from_file_auto_falls_back_for_anonymous_handle: Auto policy
  never errors on a regular file (Iocp or Std both acceptable).
- pump_drains_burst_larger_than_batch_size: 4x batch-size completion
  burst dispatches without loss, exercising the dynamic-growth path.
- iocp_error_insufficient_buffer_round_trips: typed variant maps to
  OutOfMemory and preserves request/capacity in the message.
- error.rs: 6 unit tests covering both variants, code recognition
  helpers, and classify_overlapped_error pass-through.

* style: cargo fmt --all
oferchen added a commit that referenced this pull request May 7, 2026
…3871)

Document the 10000-file / 32-thread stress workload, completion-port
queue-depth and latency metrics, and disk-full / ENOMEM failure
injection cases that gate the Windows IOCP disk-commit path before it
is declared production-ready. Cites the #1899 IOCP benchmark and the
in-flight #1929 / #1930 hardening work.
oferchen added a commit that referenced this pull request May 18, 2026
…3871)

Document the 10000-file / 32-thread stress workload, completion-port
queue-depth and latency metrics, and disk-full / ENOMEM failure
injection cases that gate the Windows IOCP disk-commit path before it
is declared production-ready. Cites the #1899 IOCP benchmark and the
in-flight #1929 / #1930 hardening work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant