# การเพิ่มประสิทธิภาพ (iOS) > Instruments, Time Profiler, Allocations, การเพิ่มประสิทธิภาพการเรนเดอร์, แบตเตอรี่, เวลาเปิดแอป - 22 คำถามสัมภาษณ์ - Senior - [คำถามสัมภาษณ์: iOS](https://sharpskill.dev/th/technologies/ios/interview-questions.md) ## 1. เครื่องมือ Instruments ใดที่ช่วยค้นหาฟังก์ชันที่ใช้เวลา CPU มากที่สุด? **คำตอบ** Time Profiler บันทึกการเรียกฟังก์ชันเป็นช่วงเวลาสม่ำเสมอและแสดงเวลาที่ใช้ในแต่ละเมธอด เครื่องมือนี้จำเป็นสำหรับการระบุคอขวดของ CPU และเข้าใจว่าแอปใช้ทรัพยากรไปที่ใด เครื่องมืออื่นๆ ใช้สำหรับด้านประสิทธิภาพที่แตกต่างกัน เช่น หน่วยความจำหรือเหตุการณ์ของระบบ ## 2. เวลาใดดีที่สุดในการ profiling การจัดสรรหน่วยความจำในแอป iOS? **คำตอบ** เครื่องมือ Allocations ควรใช้เพื่อวัดการใช้หน่วยความจำทั้งหมด ระบุ memory leak และตรวจสอบรูปแบบการจัดสรร เครื่องมือนี้มีประโยชน์อย่างยิ่งระหว่างเซสชันผู้ใช้ที่ยาวนานเพื่อตรวจจับการเติบโตของหน่วยความจำอย่างต่อเนื่อง ต่างจาก Time Profiler ที่วัด CPU โดย Allocations จะตรวจสอบ heap ของหน่วยความจำโดยเฉพาะ ## 3. บทบาทหลักของเครื่องมือ Leaks ใน Instruments คืออะไร? **คำตอบ** เครื่องมือ Leaks ตรวจจับออบเจ็กต์ที่ถูกจัดสรรแต่ไม่เคยถูกปล่อยคืน ซึ่งเกิดจากการอ้างอิงแบบวนรอบหรือข้อผิดพลาดในการจัดการหน่วยความจำ มันจะวิเคราะห์ heap ของ Objective-C โดยอัตโนมัติและระบุพื้นที่หน่วยความจำที่ถูกทิ้ง เครื่องมือนี้แตกต่างจาก Allocations: ในขณะที่ Allocations แสดงการใช้งานโดยรวม Leaks จะมุ่งเน้นที่การรั่วไหลเฉพาะจุด การรั่วไหลจะลดหน่วยความจำที่ใช้ได้ลงเรื่อย ๆ และอาจทำให้เกิด crash ## มีอีก 19 คำถาม - จะตีความผลลัพธ์ของ Time Profiler ระหว่างการ profiling อย่างไร? - เครื่องมือ Instruments ใดที่วิเคราะห์ประสิทธิภาพการ rendering และเฟรมที่หลุดหาย? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ iOS อื่นๆ - [พื้นฐาน Swift](https://sharpskill.dev/th/technologies/ios/interview-questions/swift-basics.md): 25 คำถาม, Junior - [พื้นฐานภาษา Swift](https://sharpskill.dev/th/technologies/ios/interview-questions/swift-language-essentials.md): 15 คำถาม, Junior - [พื้นฐาน UIKit](https://sharpskill.dev/th/technologies/ios/interview-questions/uikit-fundamentals.md): 18 คำถาม, Junior - [วงจรชีวิตของ UIViewController](https://sharpskill.dev/th/technologies/ios/interview-questions/uiviewcontroller-lifecycle.md): 20 คำถาม, Junior - [UserDefaults & Keychain](https://sharpskill.dev/th/technologies/ios/interview-questions/userdefaults-keychain.md): 20 คำถาม, Junior - [วงจรชีวิตของแอปพลิเคชัน](https://sharpskill.dev/th/technologies/ios/interview-questions/app-lifecycle.md): 20 คำถาม, Junior - [Auto Layout & Constraints](https://sharpskill.dev/th/technologies/ios/interview-questions/auto-layout-constraints.md): 24 คำถาม, Mid-Level - [UITableView & UICollectionView](https://sharpskill.dev/th/technologies/ios/interview-questions/uitableview-uicollectionview.md): 25 คำถาม, Mid-Level - [พื้นฐาน SwiftUI](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-basics.md): 18 คำถาม, Mid-Level - [การจัดการ State ใน SwiftUI](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-state-management.md): 22 คำถาม, Mid-Level - [การนำทาง SwiftUI](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-navigation.md): 18 คำถาม, Mid-Level - [Networking & URLSession](https://sharpskill.dev/th/technologies/ios/interview-questions/networking-urlsession.md): 20 คำถาม, Mid-Level - [Codable และการแยกวิเคราะห์ JSON](https://sharpskill.dev/th/technologies/ios/interview-questions/codable-json-parsing.md): 20 คำถาม, Mid-Level - [Core Data](https://sharpskill.dev/th/technologies/ios/interview-questions/core-data.md): 22 คำถาม, Mid-Level - [การเขียนโปรแกรมเชิงโปรโตคอล](https://sharpskill.dev/th/technologies/ios/interview-questions/protocol-oriented-programming.md): 20 คำถาม, Mid-Level - [สถาปัตยกรรม MVVM](https://sharpskill.dev/th/technologies/ios/interview-questions/mvvm-architecture.md): 20 คำถาม, Mid-Level - [การแจ้งเตือนแบบ Push](https://sharpskill.dev/th/technologies/ios/interview-questions/push-notifications.md): 18 คำถาม, Mid-Level - [Unit Testing และ XCTest](https://sharpskill.dev/th/technologies/ios/interview-questions/unit-testing-xctest.md): 20 คำถาม, Mid-Level - [การทดสอบ UI](https://sharpskill.dev/th/technologies/ios/interview-questions/ui-testing.md): 18 คำถาม, Mid-Level - [Xcode และระบบ Build](https://sharpskill.dev/th/technologies/ios/interview-questions/xcode-build-system.md): 16 คำถาม, Mid-Level - [Swift Package Manager](https://sharpskill.dev/th/technologies/ios/interview-questions/swift-package-manager.md): 16 คำถาม, Mid-Level - [Memory Management & ARC](https://sharpskill.dev/th/technologies/ios/interview-questions/memory-management-arc.md): 22 คำถาม, Senior - [Combine Framework](https://sharpskill.dev/th/technologies/ios/interview-questions/combine-framework.md): 24 คำถาม, Senior - [Concurrency & async/await](https://sharpskill.dev/th/technologies/ios/interview-questions/concurrency-async-await.md): 26 คำถาม, Senior - [iOS Design Patterns](https://sharpskill.dev/th/technologies/ios/interview-questions/ios-design-patterns.md): 24 คำถาม, Senior - [ความปลอดภัยและการเข้ารหัส](https://sharpskill.dev/th/technologies/ios/interview-questions/security-encryption.md): 20 คำถาม, Senior - [SwiftUI Advanced](https://sharpskill.dev/th/technologies/ios/interview-questions/swiftui-advanced.md): 22 คำถาม, Senior - [สถาปัตยกรรมแอปพลิเคชัน iOS](https://sharpskill.dev/th/technologies/ios/interview-questions/ios-app-architecture.md): 22 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/ios/interview-questions/performance-optimization