Performance Profiling
ทำไมต้อง Profiling
Section titled “ทำไมต้อง Profiling”การ profiling คือกระบวนการวิเคราะห์ว่าโค้ดของเราใช้ทรัพยากรอะไรบ้าง ใช้เวลาอย่างไร และมีจุดไหนที่เป็น bottleneck ก่อนจะปรับ performance ต้องรู้ก่อนว่าปัญหาอยู่ตรงไหน มิฉะนั้นอาจเสียเวลาแก้จุดที่ไม่ได้ช่วยอะไร
Profiling Types
Section titled “Profiling Types”| Type | Purpose | Tools | When to Use |
|---|---|---|---|
| CPU | หาโค้ดที่ใช้เวลาประมวลผลมาก | cProfile, py-spy | Response ช้า |
| Memory | หา memory leaks/bloat | memory_profiler, objgraph | Memory สูง |
| I/O | หา slow queries/network | django-silk, debug-toolbar | DB ช้า |
| Async | หา blocking calls | py-spy, async-profiler | Async ทำงานช้า |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google