• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: IOS floating point performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IOS floating point performance


  • Subject: Re: IOS floating point performance
  • From: David Rowland <email@hidden>
  • Date: Thu, 08 Aug 2013 13:45:39 -0700

Fascinating (Spock - Star Trek, 1967)

I added just this to the loop

    for (int jj = 0; jj<100;++jj)
    {
      T += (float)jj/1000.00;
……..

The time for 100 iterations is 0.033 sec. about ten times slower than before. I guess some optimizations remain.

Still, that works out at 330 microseconds for one iteration, pretty good.

D




On Aug 8, 2013, at 1:14 PM, Thomas Wetmore <email@hidden> wrote:

> David,
>
> Why don't you increment T by a little bit in each iteration, say by jj/1000., to prove that no optimization is occurring? I would do it but I develop for Mac OSX only.
>
> Tom Wetmore
>
> On Aug 8, 2013, at 3:59 PM, David Rowland <email@hidden> wrote:
>
>> I ran it in Debug mode which should turn off most optimizations. I ran the loop 100 times and then 200 times. The latter took almost exactly twice the time as the former. The results are saved in instance variables of the C++ class this belongs to.
>>
>>
>> On Aug 8, 2013, at 12:06 PM, Sandy McGuffog <email@hidden> wrote:
>>
>>> Be careful using that code as a test; a good optimizing compiler could pick up that sin is a library function without side effects, and no result is saved, and optimize that loop to two calls to adjustValueRadians.
>>>
>>> Sandy
>>>
>>> On Aug 8, 2013, at 8:17 PM, Thomas Wetmore <email@hidden> wrote:
>>>
>>>> David,
>>>>
>>>> Those are lightening speeds. So I agree with you wholeheartedly -- there is no sense in working on a custom table-driven approach. The current approach must already be table-based with speeds like that.
>>>>
>>>> Tom Wetmore
>>>>
>>>>
>>>> On Aug 8, 2013, at 1:26 PM, David Rowland <email@hidden> wrote:
>>>>
>>>>> I wrote an app that calculates the positions of Sun and Moon and other information as well. The heart of the Moon calculation is this. I added a loop around it and called a stopwatch at the beginning and end.
>>>>>
>>>>> startTime();
>>>>> for (int jj = 0; jj<100;++jj)
>>>>> {
>>>>> //in radians
>>>>> double lambda = 3.81040282295402 + 8399.70910754626 * T
>>>>> + 0.109781209950443 * sin(adjustValueRadians(2.35619449019234 + 8328.69146829639 * T))
>>>>> - 0.022165681500328 * sin(adjustValueRadians(4.5256387504213 - 7214.06294691607 * T))
>>>>>
>>>>> One hundred times through this loop, on my iPhone 5, took about 0.0028 seconds. Two hundred times took about 0.0056 sec.
>>>>>
>>>>> I infer that one pass takes about 0.000028 seconds, or 28.0 microseconds.
>>>>>
>>>>> The functions are probably very carefully written and could not be improved by table lookups, vector libraries, etc. That is barking up the wrong tree.
>>>>>
>>>>> David

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: IOS floating point performance (From: Trygve Inda <email@hidden>)
 >Re: IOS floating point performance (From: email@hidden)
 >Re: IOS floating point performance (From: Thomas Wetmore <email@hidden>)
 >Re: IOS floating point performance (From: Thomas Wetmore <email@hidden>)
 >Re: IOS floating point performance (From: Fritz Anderson <email@hidden>)
 >Re: IOS floating point performance (From: Thomas Wetmore <email@hidden>)
 >Re: IOS floating point performance (From: David Rowland <email@hidden>)
 >Re: IOS floating point performance (From: Thomas Wetmore <email@hidden>)
 >Re: IOS floating point performance (From: Sandy McGuffog <email@hidden>)
 >Re: IOS floating point performance (From: David Rowland <email@hidden>)
 >Re: IOS floating point performance (From: Thomas Wetmore <email@hidden>)

  • Prev by Date: Re: IOS floating point performance
  • Next by Date: Re: Single Click not Called on NSTextAttachment
  • Previous by thread: Re: IOS floating point performance
  • Next by thread: Re: IOS floating point performance
  • Index(es):
    • Date
    • Thread