benchmark-zsh-startup

Benchmarks and attributes zsh startup latency using zsh-bench, zprof, and xtrace.

3|Updated Jan 14, 2014
One-click install
npx skills add https://github.com/prateek/dotfiles --skill benchmark-zsh-startup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: benchmark-zsh-startup
Source: https://github.com/prateek/dotfiles/tree/main/skills/benchmark-zsh-startup
Command: npx skills add https://github.com/prateek/dotfiles --skill benchmark-zsh-startup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Benchmark and attribute zsh startup and prompt latency. Use when asked to profile a slow zsh prompt, explain where shell startup time is spent, compare zsh-bench with zprof or xtrace, or decide which zsh plugin, hook, or startup file to optimize first. Also use when the task is to track which zsh features, widgets, completions, or plugin-provided commands are actually being used.

Core Features & Use Cases

  • Baseline interactive startup latency across the shell startup path.
  • Attribute latency to functions, plugins, hooks, and prompt rendering using zprof and xtrace.
  • Separate first-run work from warm runs and provide actionable optimization recommendations for shell startup.

Quick Start

Use zsh-bench to benchmark zsh prompt startup, attribute the time to specific startup steps, and recommend the next changes to test.

Frequently Asked Questions about benchmark-zsh-startup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I benchmark zsh startup latency and find what is slowing down my prompt?

To benchmark zsh startup latency, you can profile the shell startup path to attribute time spent in specific functions, plugins, and hooks. This process separates first-run work from warm runs to provide actionable optimization recommendations.

What is the best way to profile a slow zsh prompt and compare zprof with xtrace?

Profiling a slow zsh prompt involves using benchmarking tools to baseline interactive startup latency and attribute it to specific steps. You can compare zprof and xtrace outputs to decide which zsh plugin, hook, or startup file to optimize first.

How do I attribute zsh startup time to specific plugins and hooks?

You attribute zsh startup time by applying tracing tools to measure latency across the shell startup path. This separates first-run work from warm runs and tracks which zsh features, widgets, completions, or plugin-provided commands are actually being used.

Can I use zsh-bench to track which zsh completions and widgets are actually being used?

Yes, zsh-bench can be applied to track which zsh features, widgets, completions, or plugin-provided commands are actively being used during startup. This helps identify unused components that contribute to unnecessary prompt latency.

Why does my zsh startup time vary between first-run and warm runs?

Zsh startup time varies because first-run work often involves heavy initialization like completions and caching, while warm runs reuse cached data. Profiling separates these distributions to provide actionable optimization recommendations for shell startup.

What are the limitations of using zprof for zsh startup attribution?

While zprof attributes function-level latency, it may lack the granular step-by-step startup path visibility provided by xtrace. Using a structured workflow with both tools ensures safe testing and accurate baseline comparisons for optimizing zsh plugins.