# iOS issues with HighResolutionTimer

**URL:** <https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655>\
**Category:** MacOSX and iOS\
**Created:** [October 14, 2013, 12:15pm UTC](https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655 "2013-10-14T12:15:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![billythekid](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/billythekid/32/88_2.png) [@billythekid](https://forum.juce.com/u/billythekid)\
**Post date:** [October 14, 2013, 12:15pm UTC](https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655/1 "2013-10-14T12:15:16Z")

</div>

I have a high resoultion timer object that is supposed to trigger the callback&nbsp;every 2 ms. This works fine on mac, but gets called about once every 500 ms on iOS. If I switch to a regular&nbsp;Timer, then the callbacks work responsively&nbsp;on iOS. Any ideas what is going on?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 14, 2013, 1:13pm UTC](https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655/2 "2013-10-14T13:13:25Z")

</div>

Weird.. No idea at all. It just runs a high-priority thread, and is the same code on iOS as for OSX,&nbsp;linux and android. I wonder if iOS has some kind of funny thread scheduling that's messing things up?

---

<div class="post-metadata">

**Author:** ![billythekid](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/billythekid/32/88_2.png) [@billythekid](https://forum.juce.com/u/billythekid)\
**Post date:** [October 14, 2013, 2:12pm UTC](https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655/3 "2013-10-14T14:12:08Z")

</div>

Weird indeed. I'll let you know if I find anything interesting.

---

<div class="post-metadata">

**Author:** ![Bruce\_Wheaton](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@Bruce\_Wheaton](https://forum.juce.com/u/Bruce_Wheaton)\
**Post date:** [November 5, 2013, 6:25pm UTC](https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655/4 "2013-11-05T18:25:03Z")

</div>

iOS will throttle things down that it thinks are being a hog. I thought that was per app, but maybe it's getting that thread? What if you trigger less often?

&nbsp;

Bruce

---

<div class="post-metadata">

**Author:** ![OverToasty](https://avatars.discourse-cdn.com/v4/letter/o/b487fb/32.png) [@OverToasty](https://forum.juce.com/u/OverToasty)\
**Post date:** [December 15, 2014, 2:30am UTC](https://forum.juce.com/t/ios-issues-with-highresolutiontimer/11655/5 "2014-12-15T02:30:01Z")

</div>

Hey Guys,

I've just implemented the HiResTimer in an App I'm working on, and tested it on my original iPad Mini: I went to 2ms accuracy as well, but in this case ( JUCE 3.1.0 , iOS 8.1 ) I had no issues. It's working like a charm ( so far ).

Mind you, I'm being resource paranoid, absolutely no new objects are constructed in the callback method, in fact, I'm not even creating stack variables ( directly accessing pre-allocated iVars only ), I doubt that last bit is really necessary, but I went with it and it was easy enough to do.

Also, for time stamping, I'm avoiding calling a method, and instead using the C function CFAbsoluteTimeGetCurrent(), in fact, in general, inside the callback methods, I'm trying to keep any extra method calling to a minimum ( though, to be honest, in Obj-C, once a method is looked up and the address is cached, the calling becomes very fast - so this probably isn't that much of an issue ).

So far, on my iPad Mini, HiResolutionTimer takes up 10% of the cycles of an App, that's using 30% of the horsepower of the iPad Mini ... not trivial, but hardly overwhelming … there's plenty of horsepower to spare, but Jules is right, don't implement HiResTimer unless you really need the extra accuracy - but if you do, it probably won't break the bank.

OT

&nbsp;
