performance-scan

Statically reviews codebases for performance bottlenecks and produces ranked, evidence-backed findings.

3|1|Updated Aug 26, 2026
One-click install
npx skills add https://github.com/zeljkoobrenovic/sokrates-skills --skill performance-scan-zeljkoobrenovic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performance-scan
Source: https://github.com/zeljkoobrenovic/sokrates-skills/tree/main/skills/scanners/performance-scan
Command: npx skills add https://github.com/zeljkoobrenovic/sokrates-skills --skill performance-scan-zeljkoobrenovic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Profiling and benchmarking are not always available, yet teams still need to know why a project is slow, what scales badly, and where memory goes. This Skill performs a static performance review of a codebase, inferring likely bottlenecks from the shape of the code and the workload it serves, and delivers a ranked, evidence-cited list of findings instead of guesswork. ## Core Features & Use Cases - Workload modeling: Builds a model of what the cost scales with (files, requests, rows) and identifies the main loop and hot paths before reading code. - Deterministic pattern counting: Ships a standard-library-only Python script that counts regex-in-loop, per-call allocations, whole-file reads, locks, parallelism, caches, and limit constants across Rust, Java, JS/TS, Python, Go, and C#. - Ranked findings report: Emits a validated JSON findings file with severity-calibrated bottlenecks, deliberate optimizations, and a synthesized performance posture, rendered into an interactive explorer. - Use Case: Ask why your analysis tool slows down on large repositories; the scanner identifies a quadratic dependency-matching stage, regex compiled per line, and a serial stage between parallel ones, each cited to the exact loop. ## Quick Start Ask the AI to run a performance scan on this repository using the existing _sokrates analysis and report the top likely bottlenecks.

Frequently Asked Questions about performance-scan

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

FAQPage Schema
How do I find performance bottlenecks without a profiler?

Run a static performance review that builds a workload model, locates the main loop, and reads hot paths for shapes like nested scans, regex compiled per item, and whole-file reads. This Skill ranks likely bottlenecks with code evidence and severity calibration.

How to detect regex compiled in a loop across a codebase?

Use the included count_perf_sites.py script, which detects Pattern.compile, replaceAll, Regex::new, and re.compile calls inside loop bodies using a brace and indent heuristic. It excludes static initializers and test code, and lists top files per shape.

Does the performance scan require a Sokrates analysis?

No, it works best with a _sokrates folder whose stage timings, file inventory, and unit metrics size the reading, but it degrades gracefully without one. Sokrates data is used for sizing and metric references, not for discovering hot paths.

What languages does the performance pattern counter support?

The script scans Rust, Java, Kotlin, Scala, JavaScript, TypeScript, Python, Go, and C# files. Language-specific shapes include Rust deep copies and blocking-in-async, JavaScript sync fs calls and await-in-loop, and Python list membership in loops.

What are the limitations of static performance analysis?

Static analysis infers cost from code shape rather than measuring it, so most findings are marked likely rather than certain. A claim that something is the bottleneck requires a workload argument, and measured timing artifacts outrank static inference when available.