Skip to content
Skills Library
Programming · Building & coding

io-optimization

/io-optimization

Reduce input/output cost by cutting round trips, moving fewer bytes, and turning random access into sequential access. Use when a workload is IO-bound: disk, network, or syscall overhead dominates while the CPU sits idle.

Repository
AI-SKILLS ↗
Licence
MIT
Last repository change
05.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Reduce input/output cost by cutting round trips, moving fewer bytes, and turning random access into sequential access. Use when a workload is IO-bound: disk, network, or syscall overhead dominates while the CPU sits idle.

Original author description

Reduce input/output cost by cutting round trips, moving fewer bytes, and turning random access into sequential access. Use when a workload is IO-bound: disk, network, or syscall overhead dominates while the CPU sits idle.

How it works

  1. Method
  2. Signals
  3. Boundaries
Original SKILL.md headings · 50 lines, 434 words
SKILL.md preview
---
name: io-optimization
description: "Reduce input/output cost by cutting round trips, moving fewer bytes, and turning random access into sequential access. Use when a workload is IO-bound: disk, network, or syscall overhead dominates while the CPU sits idle."
---

# IO optimization

Input/output is slow per operation and cheap per byte once started, so the
enemy is the number of operations and the distance a disk head or network
packet has to travel. A loop that reads one row per query, or writes one byte
per syscall, spends almost all its time in overhead. Fix IO by batching calls,
shrinking payloads, and following the medium's grain.

## Method

1. **Confirm the workload is IO-bound.** Check that CPU utilization is low while
   throughput lags: `iostat`, `iotop`, `%iowait` in `top`, or a profiler showing
   time parked in read and write. If the CPU is pinned instead, this is the
   wrong skill.
2. **Batch many small operations into few large ones.** Replace per-row queries
   with one `IN` list or bulk fetch, per-record writes with a `COPY` or
   multi-row insert, per-item HTTP calls with a batch endpoint. One round trip
   of a thousand items beats a thousand round trips whose cost is latency, not
   size.
3. **Buffer at the boundary.** Wrap raw file and socket handles in a buffered
   reader and writer (`bufio`, `BufferedReader`, `BufferedOutputStream`) so the
   kernel sees 64KB syscalls, not one per byte. Flush deliberately; do not
   `fsync` per record when a batch fsync is correct.
4. **Prefer sequential access to random.** Disks and read-ahead reward in-order
   access; a sequential scan can beat scattered seeks by an order of magnitude
   even on SSDs. Sort work by key before reading, lay files out to be read the
   way they are written, and let the page cache and prefetcher help.
5. **Move fewer bytes.** Request only the columns and rows you need instead of
   `SELECT *` then filtering in code. Compress payloads that cross a slow link
   so you trade cheap CPU for scarce bandwidth. Cache or memoize reads whose
   source has not changed.
6. **Overlap IO with work.** Issue reads ahead of when they are consumed, use
   async or a small thread pool so a request in flight does not block unrelated
   computation, and pipeline stages so disk and CPU stay busy at once.

## Signals

- Is `%iowait` high and CPU low, confirming IO is the bottleneck?
- Did operation count per unit of work drop, not just per-op latency?
- Is access sequential where the medium rewards it, or still seek-heavy?
- Are payloads trimmed to needed bytes before they cross the wire or platter?

## Boundaries

This cuts the cost and count of IO operations. Choosing a compression codec by
ratio and CPU is compression-tradeoffs; structuring the event loop that overlaps
async IO is async-io-patterns. Database-side query cost and indexing defer to
sql-optimization.

Versions

The database has no other skills named io-optimization.

Database snapshot: 13.11.2026 · package version 003e09cfdaba (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90serialization-performance
    Cut the CPU and bytes spent turning objects into wire or disk format by choosing the right format, reusing schemas and buffers, and avoiding copies. Use when serialization shows up in the profile, payloads are large, or encode/decode latency dominates a hot request path.
  • 100first-load-byte-reduction
    Use when a first screen needs lower transfer bytes without visual or behavioral change. Not for visual redesign or behavioral changes.
  • 90cpu-optimization
    Speed up a CPU-bound hot path by fixing its algorithm and memory access first, then applying micro-optimization only where the profiler still points. Use when a function dominates CPU time and you need it faster without changing what it computes.
  • 100first-load-byte-reduction
    Use when a first screen needs lower transfer bytes without visual or behavioral change. Not for visual redesign or behavioral changes.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.