OpenParable
Skip to content
← Back to skills

Hello Perf

Development
hello-perf

Hello Perf is an Agent Skill for development published in the hellowind777/helloagents repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

优化性能、处理数据库查询、实现缓存、懒加载、分页、打包优化,或代码涉及大数据集循环、并发操作、内存管理时使用。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/hellowind777/helloagents/blob/HEAD/skills/hello-perf/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/hello-perf, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

性能相关代码必须遵循以下规范。

编码前

先定位性能瓶颈(I/O / 计算 / 内存),再写代码。

查询优化

  • 禁止 N+1 查询:使用 JOIN、批量加载、dataloader
  • 大数据集必须分页,不一次加载全部
  • 数据库索引覆盖常用查询条件
  • 只查需要的字段(SELECT 具体列,不用 SELECT *)

缓存策略

  • 读多写少的数据 → 缓存(内存/Redis)
  • 设置合理的 TTL
  • 缓存失效策略:写时失效 > 定时过期
  • 防止缓存穿透(空值缓存)和雪崩(随机 TTL)

前端性能

  • 代码分割 + 路由级懒加载
  • 图片:WebP/AVIF、懒加载、srcset 响应式
  • 声明 width/height 或 aspect-ratio 防止布局偏移
  • 关键 CSS 内联,非关键 CSS 异步加载
  • 50+ 项列表使用虚拟滚动

算法与并发

  • 注意时间复杂度,禁止嵌套循环处理大数据集(O(n²)+)
  • Map/Set 查找 O(1) vs Array.includes O(n)
  • 批量操作优于逐条操作
  • 高频事件(scroll/resize/input)使用 debounce/throttle

交付检查

  • 无 N+1 查询
  • 列表接口有分页
  • 图片已优化(格式/懒加载/尺寸声明)
  • 无嵌套循环处理大数据集