[ios 8] 測れる!パフォーマンス
DESCRIPTION
Xcode 6 から追加されたパフォーマンス測定の機能を紹介します。TRANSCRIPT
- 1. Copyright Classmethod, Inc. Xcode 6
- 2. iPhone AB Copyright Classmethod, Inc.
- 3. BotsYosemiteServer 4.0 Copyright Classmethod, Inc.
- 4. / Copyright Classmethod, Inc.
- 5. Copyright Classmethod, Inc.
- 6. Testself.measureBlock(){} Copyright Classmethod, Inc. func testPerformanceExample() { // This is an example of a performance test case. self.measureBlock() { // Put the code you want to measure the time of here. } }
- 7. Function class Logger { let max = 10000 func writeNSLog(){ for var i = 0; i < max; i++ { NSLog("%d",i) } } func writePrintln(){ for var i = 0; i < max; i++ { println(NSDate.date().description + " " + String(i)) } } NSLogPrintln1 Copyright Classmethod, Inc.
- 8. import XCTest class BotsTests: XCTestCase { func testLoggerPrintln() { let logger = Logger() self.measureBlock() { logger.writePrintln() } } func testLoggerNSLog() { let logger = Logger() self.measureBlock() { logger.writeNSLog() } NSLog} Println1 } Copyright Classmethod, Inc.
- 9. Test NavigatorU Copyright Classmethod, Inc.
- 10. 10 Copyright Classmethod, Inc. 10
- 11. 10 Copyright Classmethod, Inc. Result Average Baseline Max STDDEV
- 12. 10 Copyright Classmethod, Inc. 3.006 2.09 43.48%
- 13. 10% (Avarage)10% Standard Deviation Copyright Classmethod, Inc.
- 14. Copyright Classmethod, Inc. No Baseline Set Baseline Baseline
- 15. Copyright Classmethod, Inc. No Baseline Set Baseline Baseline
- 16. Copyright Classmethod, Inc. Baseline Result
- 17. Result: 20.788% better (17%) Baseline 20.788% 17% Copyright Classmethod, Inc.
- 18. Max STDDEV) Copyright Classmethod, Inc. AND Baseline
- 19. Copyright Classmethod, Inc. /
- 20. NSLogprintln1 println(i) -> 0.35 NSLog(%d,i) 2.3 Copyright Classmethod, Inc. println 7
- 21. Bots Copyright Classmethod, Inc.
- 22. Copyright Classmethod, Inc.