Skip to content

Feat/io wait - #29

Merged
MikiEEE merged 2 commits into
developfrom
feat/io_wait
Aug 16, 2026
Merged

MikiEEE merged 2 commits into
developfrom
feat/io_wait

Conversation

@MikiEEE

@MikiEEE MikiEEE commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

This PR improves SmallOS I/O wait efficiency by keeping readiness registrations alive across scheduler iterations instead of rebuilding the complete polling set before every wait.

  • Adds optional Kernel.create_io_wait_set() support while preserving Kernel.io_wait() as the compatibility fallback.
  • Uses a persistent selector on Unix, with PollSelector on macOS based on benchmark results.
  • Reuses poll()/ipoll() registrations on supported MicroPython platforms.
  • Updates registrations only when read/write interests change.
  • Removes the duplicate zero-time wait before an idle blocking wait.
  • Adds OSList.has_ready() for checking runnable work without dequeuing it.
  • Includes deterministic lifecycle tests and an I/O benchmark.
  • Adds no runtime dependencies and preserves custom-kernel compatibility.

Performance

Local macOS benchmark results:

  • 256 idle descriptors: 91.62 μs → 35.45 μs (2.58x)
  • 256 descriptors, one ready: 80.85 μs → 26.46 μs (3.06x)
  • Runnable scheduler with one watcher: 20.26 μs → 14.29 μs (1.42x)

Validation

  • All 83 unit tests pass.
  • Unix and MicroPython-style persistent polling paths are covered.
  • Tests cover registration deltas, cancellation, restart, descriptor reuse,
    invalid descriptors, combined masks, error events, and snapshot fallback.
  • demos/unix_demo.py passes.
  • Package build, wheel smoke test, compilation, documentation indexing, and
    git diff --check pass.

Follow-up

The execution-adapter work lives on a separate branch. Once merged, adapter
completion sources should use the same first/last-source delta registration
path.

@MikiEEE
MikiEEE changed the base branch from master to develop August 16, 2026 01:02
@MikiEEE
MikiEEE marked this pull request as ready for review August 16, 2026 01:37
@MikiEEE
MikiEEE merged commit eaa7919 into develop Aug 16, 2026
14 of 16 checks passed
@MikiEEE
MikiEEE deleted the feat/io_wait branch August 22, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant