tokio-performance

tokio-performance is a skill for Claude Code, Codex from d-oit/rust-2026-template. It costs 60 tokens per session (3,224 once invoked), scanned A, original, MIT.

A guide for improving asynchronous Rust programs that use Tokio, a library for running many tasks without blocking the main thread. It covers throughput, response time, fairness, locks, channels, blocking work, and limits on concurrent tasks.

In plain words
What is it for?
Use it to review Tokio runtime design, choose between direct execution and blocking worker threads, tune task scheduling, and investigate contention or slow tail responses.
Why use it?
It helps avoid performance changes based on assumptions, such as treating all asynchronous code as faster or creating more tasks without measuring the result.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents); mentions AGENTS.md.

Good fit Use it to review Tokio runtime design, choose between direct execution and blocking worker threads, tune task scheduling, and investigate contention or slow tail responses.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/d-oit/rust-2026-template/tokio-performance
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add d-oit/rust-2026-template --skill tokio-performance
Clone the repo
git clone --depth 1 https://github.com/d-oit/rust-2026-template

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tokio-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/d-oit/rust-2026-template/tokio-performance/github.svg)](https://agentmods.dev/skills/d-oit/rust-2026-template/tokio-performance)
Your own site
<a href="https://agentmods.dev/skills/d-oit/rust-2026-template/tokio-performance"><img src="https://agentmods.dev/badge/skills/d-oit/rust-2026-template/tokio-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tokio-performance

Your own site · 80×15
<a href="https://agentmods.dev/skills/d-oit/rust-2026-template/tokio-performance"><img src="https://agentmods.dev/badge/skills/d-oit/rust-2026-template/tokio-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,224 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.03224
Opus 5.5 $0.00024 $0.01290
Sonnet 5 $0.00012 $0.00645
Haiku 4.5 $0.00006 $0.00322

Measured 6d ago against content hash 5f6fcfa1eafa, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-24, from the pricing page.

Security

Grade A, and why

tokio-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/tokio-performance/SKILL.md · 250 lines

How it starts

The opening of the file, as written. The whole thing — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tokio Performance

Performance guidance for production Rust systems using Tokio. Optimize measured behavior from workload characteristics, not async code by reflex.

Core Rule

Measure first. Derive execution models, concurrency bounds, and lock strategies from workload characteristics.

Do not assume:

  • async is faster than synchronous code
  • spawn_blocking is always better for CPU work
  • tokio::sync::Mutex or RwLock is preferable to a synchronous lock or atomic/snapshot pattern
  • more tasks or more runtimes mean more throughput
  • yield_now() everywhere improves fairness

Workload Decision Matrix

Workload Type Characteristics Recommended Execution Model Key Considerations
Short Bounded CPU Fast, non-blocking calculations (< 10–100 µs), memory parsing, small serializations Direct Execution on Tokio Worker Offloading to spawn_blocking introduces thread context switches and queue overhead that exceed the work duration.
Genuinely Blocking Synchronous disk I/O, blocking C/FFI calls, legacy blocking SDKs, blocking DB drivers spawn_blocking or Dedicated Thread Pool Prevents blocking the Tokio worker thread event loop.
Long or Sustained CPU Image processing, heavy cryptography, compression, large payload parsing (> 100 µs - ms+) spawn_blocking or Dedicated Worker Pool Protects Tokio worker threads from starvation. For sustained heavy CPU, prefer a dedicated Rayon/thread pool to avoid exhausting Tokio's blocking pool.
Batchable Operations High-rate small I/O operations, frequent channel sends, small database updates Batching & Micro-buffering Consolidates syscalls, locks, and channel synchronization overhead.
Isolated Subsystems Multi-tenant latency isolation, distinct thread priority requirements Workload Isolation Isolate via bounded semaphores or separate thread pools before considering a separate Tokio runtime.

Correctness vs. Performance Heuristics

Read the full file on GitHub · 250 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 250 lines · 60 tokens per session scan A 5f6fcfa1eafa

Subscribe to this mod's changes

tokio-performance is a skill published in the GitHub repository d-oit/rust-2026-template (11 stars, last pushed yesterday), licensed MIT. It adds 60 tokens to every session and 3,224 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-18.

Related

Other skills, from other repositories

hotpath_init

Configure hotpath profiling in a Rust project. Adds the hotpath dependency with feature-gated setup, instruments main with hotpath::main, functions with measure/measureall, and wraps channels, mutexes, rwlocks, streams, futures, reqwest clients, axum routers and byte-level I/O with hotpath macros. Use when the user…

pawurb/hotpath-rs · 88 tokens

rust-check

Run cargo check on the current Rust project to find compile errors.

Hmbown/CodeWhale · 15 tokens

stack-trace-rust-probe

Internal helper for meta-stack-trace-investigator. Use when a Rust panic or backtrace needs Rust-specific Result/Option checks, cargo test guidance, and patch targets.

opensquilla/opensquilla · 42 tokens

syncmeta

Sync changes from the hotpath, hotpath-macros and hotpath-drain crates to their meta counterparts (hotpath-meta, hotpath-macros-meta and hotpath-drain-meta). Use when meta crates need to be updated with recent changes.

pawurb/hotpath-rs · 55 tokens

hotpath_bump

Bump the hotpath version number across the workspace and related files. Updates crate versions in Cargo.toml files (exact patch version) and version references in the backend middleware, hotpathinit skill, and README (major.minor only). Use when the user wants to bump, bump the version, or release a new hotpath…

pawurb/hotpath-rs · 73 tokens

clickhouse-rust-type-mismatches

Fix ClickHouse query errors in Rust when using clickhouse-rs crate. Use when: (1) "string is not valid utf8" errors - typically FixedString columns need CAST to String, (2) "tag for enum is not valid" errors - typically Option fields receiving non-NULL values, (3) Sum/count aggregations returning Float64 but Rust…

divinevideo/divine-mobile · 280 tokens