Instruments in Xcode 8.3.2

2017-06-04  本文已影响0人  John易筋

Purpose

Every iOS developer inevitably runs into two common issues during development:


If you're new to the iOS landscape I encourage you to experiment with instruments.
In this post I am going to cover 3 instruments I routinely use with every app I lay my hands on.

The Example App

swift demo: https://github.com/mcgraw/dojo-instruments

Open Instuments

Step By Step

Instrument-1.png
Instrument-2.png
Instrument-3.png

Time Profiler

**The Time Profile instrument captures stack trace information depending on interval (default is 1ms).
It provide a decent approximation for how much time a given method took by comparing the state of the stack trace against the interval. **
Step By Step

Timer-1.png
Timer-2.png

Allocation Profiler

Often times, especially with photo apps, you'll run into scenarios where you must download a lot of images from a server.
If you're not careful memory usage can ballon dramatically.
You must make sure that you are caching images to the side that you expect to reuse.

Step By Step

Allocation-1.png
Allocation-2.png
Allocation-3.png

Leaking Memory

Even though Apple introduced ARC, you need to be aware that the potentail for leaks for leaks do remain. Even if you're using swift.
Step By Step

Leak-1.png
Leak-2.png

Reference

上一篇 下一篇

猜你喜欢

热点阅读