performance-investigation

โดย sveltejs

ตรวจสอบปัญหาประสิทธิภาพที่ถดถอยและหาโอกาสในการปรับปรุงให้ดียิ่งขึ้น

npx skills add https://github.com/sveltejs/svelte --skill performance-investigation

Quick start

  1. Start from a branch you want to measure (for example foo).
  2. Run:
pnpm bench:compare main foo

If you pass one branch, bench:compare automatically compares it to main.

Where outputs go

  • Summary report: benchmarking/compare/.results/report.txt
  • Raw benchmark numbers:
    • benchmarking/compare/.results/main.json
    • benchmarking/compare/.results/<your-branch>.json
  • CPU profiles (per benchmark, per branch):
    • benchmarking/compare/.profiles/main/*.cpuprofile
    • benchmarking/compare/.profiles/main/*.md
    • benchmarking/compare/.profiles/<your-branch>/*.cpuprofile
    • benchmarking/compare/.profiles/<your-branch>/*.md

The .md files are generated summaries of the CPU profile and are usually the fastest way to inspect hotspots.

Suggested investigation flow

  1. Open benchmarking/compare/.results/report.txt and identify largest regressions first.
  2. For each high-delta benchmark, compare:
    • benchmarking/compare/.profiles/main/<benchmark>.md
    • benchmarking/compare/.profiles/<branch>/<benchmark>.md
  3. Look for changes in self/inclusive hotspot share in runtime internals (runtime.js, reactivity/batch.js, reactivity/deriveds.js, reactivity/sources.js).
  4. Make one optimization change at a time, then re-run targeted benches before re-running full compare.

Fast benchmark loops

Run only selected reactivity benchmarks by substring:

pnpm bench kairo_mux kairo_deep kairo_broad kairo_triangle
pnpm bench repeated_deps sbench_create_signals mol_owned

Tests to run after perf changes

Runtime reactivity regressions are most likely in runes runtime tests:

pnpm test runtime-runes

Helpful script

For quick cpuprofile hotspot deltas between two branches:

node benchmarking/compare/profile-diff.mjs kairo_mux_owned main foo

This prints top function sample-share deltas for the selected benchmark.

Practical gotchas

  • bench:compare checks out branches while running. Avoid uncommitted changes (or stash them) so branch switching is safe.
  • Each bench:compare run rewrites benchmarking/compare/.results and benchmarking/compare/.profiles.

Skills เพิ่มเติมจาก sveltejs

performance-investigation
sveltejs
ตรวจสอบการถดถอยของประสิทธิภาพและค้นหาโอกาสในการปรับให้เหมาะสม
official
svelte-code-writer
sveltejs
เครื่องมือ CLI สำหรับการค้นหาเอกสาร Svelte 5 และวิเคราะห์โค้ดพร้อมระบบแก้ไขอัตโนมัติในตัว คำสั่งหลักสามคำสั่ง: list-sections เพื่อเรียกดูเอกสารที่มี, get-documentation เพื่อดึงเอกสารฉบับเต็มสำหรับหัวข้อเฉพาะ, และ svelte-autofixer เพื่อวิเคราะห์โค้ดและแนะนำการแก้ไข Autofixer รองรับ Svelte 4 และ 5 โดยกำหนดเป้าหมายผ่านแฟล็ก --svelte-version และโหมด async ผ่านแฟล็ก --async รองรับทั้งโค้ดแบบอินไลน์ (ที่มีอักขระ $ ที่ถูก Escape) และพาธไฟล์สำหรับการวิเคราะห์ ออกแบบมาเพื่อใช้ภายใน...
official
svelte-core-bestpractices
sveltejs
คำแนะนำในการเขียนโค้ด Svelte ที่รวดเร็ว แข็งแกร่ง และทันสมัย โหลดสกิลนี้เมื่ออยู่ในโปรเจกต์ Svelte และถูกขอให้เขียน/แก้ไข หรือวิเคราะห์คอมโพเนนต์ Svelte หรือ…
official
svelte-code-writer
sveltejs
เครื่องมือ CLI สำหรับค้นหาเอกสาร Svelte 5 และวิเคราะห์โค้ด ต้องใช้เมื่อสร้าง แก้ไข หรือวิเคราะห์คอมโพเนนต์ Svelte (.svelte) หรือ Svelte…
official
svelte-core-bestpractices
sveltejs
Guidance on writing fast, robust, modern Svelte code. Load this skill whenever in a Svelte project and asked to write/edit or analyze a Svelte component or…
official
scenario-writer
sveltejs
เลือกสถานการณ์ใหม่ที่จะสร้างขึ้นตามคำอธิบายของผู้ใช้ มอบหมายการเขียนให้กับซับเอเจนต์ ai-scenario-writer และตรวจสอบความถูกต้อง
official
writing-opencode-plugins
sveltejs
ปลั๊กอิน OpenCode, @opencode-ai/plugin, @opencode-ai/plugin/tui, ฮุคของปลั๊กอิน, เครื่องมือที่กำหนดเอง, เส้นทาง TUI, สล็อต, คีย์แมป, และการบรรจุแพ็กเกจ ใช้เมื่อสร้าง,...
official
scenario-writer
sveltejs
เลือกสถานการณ์ใหม่ที่จะสร้างตามคำอธิบายของผู้ใช้ มอบหมายการเขียนให้กับ ai-scenario-writer subagent และตรวจสอบความถูกต้อง
official