Last night we had a different format for the Hawaii iOS Developer meetup. Usually I prepare a talk for the developers. When we meet we do introductions, I deliver the talk, and we leave room for discussion and questions.
The topic of the night was Intruments and LLDB in Xcode. Aron asked for feedback on using Intruments in Xcode a few meetups ago so I added it to the agenda.
Zac just released his game Dodge It Rocket to the app store this past week. He ran into an issue in his code where a UILabel was being initialized at runtime.
John mentioned that init’ing a UILabel at runtime would cause the frame rate to drop because the program is having to load a gigantic texture file every time a new label is being requested.
As the meetup progressed we were able to identify a potential fix (initializing the labels and reusing them). We also set up a loop in the code to isolate the problem and have the program call the offending code over and over. This allowed us to save time, navigating the in-game ship to trigger the piece of code we were testing.
I’ve never thought of isolating a piece of code in a loop to have it spin up a bunch of times to make the memory/performance issue come to light.
Once we identified the issue, put it in a loop, and ran the code a few times, we put it through Instruments. I’ll pause here. I did a bunch of research into instruments and felt that I had a good feel for how it worked. Not so much. When I tried to leverage the skills I learned about Instruments in YouTube videos. The understanding broke down when it came to profiling Zac’s code.
We all laughed at the end of the session. We really don’t know Instruments. Marking this subject as something we definitely need to loop back around to.
It was helpful to band around the issue and leverage our individual experiences with code to help Zac identify the bug, propose a testing method, and learn more about best practices.
I am very happy with this style of having other developers bring in their code for review.
We’ll be covering In-App Purchase and Ads next week. Please RSVP if you’re interested in attending.