Performance Optimization Skill
Description
Systematic performance analysis and optimization for RTK CLI tool, focusing on **startup time (<10ms)**, **memory usage (<5MB)**, and **token savings (60-90%)**.
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
Repository README
This is the README for rtk-ai/rtk, shared by 9 entries
in this directory. It describes the repository, not this entry specifically.
description: CLI performance optimization - startup time, memory usage, token savings benchmarking
Performance Optimization Skill
Systematic performance analysis and optimization for RTK CLI tool, focusing on **startup time (<10ms)**, **memory usage (<5MB)**, and **token savings (60-90%)**.
When to Use
- Automatically triggered: After filter changes, regex modifications, or dependency additions
- Manual invocation: When performance degradation suspected or before release
- Proactive: After any code change that could impact startup time or memory
RTK Performance Targets
| Metric | Target | Verification Method | Failure Threshold |
|---|---|---|---|
| Startup time | <10ms | hyperfine 'rtk ' |
>15ms = blocker |
| Memory usage | <5MB resident | /usr/bin/time -l rtk (macOS) |
>7MB = blocker |
| Token savings | 60-90% | Tests with count_tokens() |
<60% = blocker |
| Binary size | <5MB stripped | ls -lh target/release/rtk |
>8MB = investigate |
Performance Analysis Workflow
1. Establish Baseline
Before making any changes, capture current performance:
# Startup time baseline
hyperfine 'rtk git status' --warmup 3 --export-json /tmp/baseline_startup.json
# Memory usage baseline (macOS)
/usr/bin/time -l rtk git status 2>&1 | grep "maximum resident set size" > /tmp/baseline_memory.txt
# Memory usage baseline (Linux)
/usr/bin/time -v rtk git status 2>&1 | grep "Maximum resident set size" > /tmp/baseline_memory.txt
# Binary size baseline
ls -lh target/release/rtk | tee /tmp/baseline_binary_size.txt
2. Make Changes
Implement optimization or feature changes.
3. Rebuild and Measure
# Rebuild with optimizations
cargo build --release
# Measure startup time
hyperfine 'target/release/rtk git status' --warmup 3 --export-json /tmp/after_startup.json
# Measure memory usage
/usr/bin/time -l target/release/rtk git status 2>&1 | grep "maximum resident set size" > /tmp/after_memory.txt
# Check binary size
ls -lh target/release/rtk | tee /tmp/after_binary_size.txt
4. Compare Results
# Startup time comparison
hyperfine 'rtk git status' 'target/release/rtk git status' --warmup 3
# Example output:
# Benchmark 1: rtk git status
# Time (mean ± σ): 6.2 ms ± 0.3 ms [User: 4.1 ms, System: 1.8 ms]
# Benchmark 2: target/release/rtk git status
# Time (mean ± σ): 7.8 ms ± 0.4 ms [User: 5.2 ms, System: 2.1 ms]
#
# Summary
# 'rtk git status' ran 1.26 times faster than 'target/release/rtk git status'
# Memory comparison
diff /tmp/baseline_memory.txt /tmp/after_memory.txt
# Binary size comparison
diff /tmp/baseline_binary_size.txt /tmp/after_binary_size.txt
5. Identify Regressions
**Startup time regression** (>15% increase or >2ms absolute):
# Profile with flamegraph
cargo install flamegraph
cargo flamegraph -- target/release/rtk git status
# Open flame
Related Skills
Epic Decompose
Break an epic into task children without creating task branches.
Productivity Claude Code Terminal Title
Gives each Claude Code terminal window a dynamic title describing the work being done
Productivity N8n Skills
Enables AI assistants to directly understand and operate n8n workflows
Productivity Workflow BundlesREADME
Workflow Bundles
Productivity Composio Make
Trigger and manage Make (Integromat) scenarios
Productivity Getting Help
career-ops is an open source project maintained in limited time. Here's how to get help efficiently.
Productivity