Welcome to Digital Ruby! We are a software company that specializes in Mobile Apps and Server Software.
Apr 18, 2014
I was tracking down some nasty bits of code today, code which when called once wasn’t noticeably slow, but when called thousands of time started to really add up.
Here are the macros I made:
#define CREATE_TIMER NSTimeInterval start, stop #define START_TIMER start = [NSDate timeIntervalSinceReferenceDate] #define CREATE_AND_START_TIMER CREATE_TIMER; START_TIMER #define END_TIMER(msg) stop = [NSDate timeIntervalSinceReferenceDate]; NSLog(@"%@", [NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]) #define PROFILE(code) static CGFloat s_totalTime = 0.0f; static long s_callCount = 0; s_callCount++; CREATE_AND_START_TIMER; code s_totalTime += ([NSDate timeIntervalSinceReferenceDate] - start); NSString* timerMsg = [NSString stringWithFormat:@"PROFILE, total time: %f, call count: %ld", s_totalTime, s_callCount]; END_TIMER(timerMsg); Usage: PROFILE([self runCodeToBeProfiled];);
- Quick and dirty profiling for iOS
- Why You Don’t Need a Schedule
- To the Cliffs – What Happens After the First Week for a New iOS App
- TexturePacker – A Fast and Easy Utility to Create Spritesheets
- The Cheapest Best Dedicated Server
- The Price is Right
- iAd vs AdMob
- Birdshot is now on the iOS App Store!
- Manual Penalty or Bad Search Algorithm?
- Bird Flight is now on the iOS App Store
- You Doodle – Now With Fleksy Integration
- No Silver Bullet
- Sage Advice from Quark
- Flappy Bird, Super Ball Juggling and Shuriken Block – Oh My
- New You Doodle Icon
- Solving the iOS App Store Search Problem
- Does Your App Icon REALLY Matter That Much?
- Factorials, Meetings and a Visual
- iOS Hardware and Model Version Numbers
- The iOS App Store has a Spam Problem
- As it Matters in Battle
- My thoughts on the Aviary (Image Editor SDK)
- Muggles and Wizards
- Meeting a Childhood Hero
- What is “nofollow” and Why Should You Care?