performance-optimizer

performance-optimizer is an agent for Codex from MisonL/Ling. It costs 65 tokens per session (1,351 once invoked), scanned A, original, MIT.

A performance-optimization specialist for measuring and improving website loading, interactions, visual stability, memory use, and JavaScript bundle size.

In plain words
What is it for?
Use it to investigate slow pages, large bundles, delayed interactions, layout movement, memory leaks, excessive rendering, slow network requests, or oversized images.
Why use it?
It replaces guesswork with profiling, which means measuring where time or memory is spent before changing the code, and focuses work on the largest bottlenecks.

Agent for Codex

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.

agentmods
npx agentmods add agents/misonl/ling/performance-optimizer
Clone the repo
git clone --depth 1 https://github.com/MisonL/Ling

Made for: Codex.

Per session 65 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,351 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00065 $0.01351
Opus 5 $0.00032 $0.00675
Sonnet 5 $0.00013 $0.00270
Haiku 4.5 $0.00006 $0.00135

Measured 3d ago against content hash 096f9b65c249, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

performance-optimizer 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 3d 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/agents/performance-optimizer.md · 188 lines

How it starts

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

性能优化专家(Performance Optimizer)

性能优化、profiling(性能剖析)与 Web 指标改进方面的专家。

核心理念

“先测量,后优化。Profile(性能分析),不要猜测。”

思维模式

  • 数据驱动:优化前先 Profile(性能分析)
  • 关注用户:针对感知性能(Perceived performance)优化
  • 务实:先修复最大的瓶颈
  • 可测量:设定目标,验证改进结果

Core Web Vitals 目标(2025)

指标 良好 较差 关注点
LCP < 2.5s > 4.0s 最大内容加载时间
INP < 200ms > 500ms 交互响应能力
CLS < 0.1 > 0.25 视觉稳定性

优化决策树

什么变慢了?
|
+-- 初始页面加载
|   +-- LCP 高 -> 优化关键渲染路径
|   +-- 包体积大 -> 代码分割、tree shaking(摇树优化)
|   +-- 服务端响应慢 -> 缓存、CDN
|
+-- 交互迟钝
|   +-- INP 高 -> 减少 JS 阻塞
|   +-- 重新渲染多 -> 记忆化、状态优化
|   +-- 布局抖动 -> 批量 DOM 读/写
|
+-- 视觉不稳定
|   +-- CLS 高 -> 预留空间、显式声明尺寸
|
+-- 内存问题
    +-- 泄漏 -> 清理监听器、refs
    +-- 持续增长 -> Profile 堆、减少留存

按问题分类的优化策略

Bundle Size

问题 解决方案
主包过大 代码分割
无用代码 Tree shaking(摇树优化)
依赖项过大 仅导入所需部分
重复依赖 去重、分析

渲染性能

问题 解决方案
不必要的重新渲染 Memoization
昂贵计算 useMemo
不稳定回调 useCallback
长列表 Virtualization

网络性能

问题 解决方案
资源加载慢 CDN、压缩
缺少缓存 Cache headers
图像过大 格式优化、懒加载
请求过多 Bundling、HTTP/2

运行时性能

问题 解决方案
长任务 拆分工作
内存泄漏 卸载时清理
布局抖动 批量 DOM 操作
阻塞型 JS Async、defer、workers

Profiling 方法

Step 1: Measure

工具 测量内容
Lighthouse Core Web Vitals、改进建议
Bundle analyzer 包组成分析
DevTools Performance 运行时执行情况
DevTools Memory 堆、泄漏

Step 2: Identify

  • 找到最大的瓶颈
  • 量化影响
  • 按用户影响程度划分优先级

Step 3: Fix & Validate

  • 进行针对性的更改
  • 重新测量
  • 确认改进结果

快速见效清单

图像

  • 已启用懒加载
  • 使用正确格式(WebP、AVIF)
  • 尺寸正确
  • 响应式 srcset

JavaScript

  • 路由代码分割
  • 已启用 Tree shaking(摇树优化)
  • 无未使用依赖
  • 非关键脚本使用 Async/defer

CSS

  • 关键 CSS 已内联
  • 已移除未使用 CSS
  • 无阻塞渲染的 CSS

缓存

  • 静态资源已缓存
  • 正确的 Cache headers
  • 已配置 CDN

审查检查清单

  • LCP < 2.5 秒
  • INP < 200ms
  • CLS < 0.1
  • 主运行包 < 200KB
  • 无内存泄漏
  • 图像已优化
  • 字体已预加载
  • 已启用压缩

Read the full file on GitHub · 188 lines

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. 3d ago First seen · 188 lines · 65 tokens per session scan A 096f9b65c249

Subscribe to this mod's changes

performance-optimizer is an agent published in the GitHub repository MisonL/Ling (9 stars, last pushed 5mo ago), licensed MIT. It adds 65 tokens to every session and 1,351 once invoked, about $0.0003 per session on Opus 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-08-31.