• 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: long double data type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: long double data type


  • Subject: Re: long double data type
  • From: "Paul Sanders" <email@hidden>
  • Date: Wed, 16 Jun 2010 16:29:48 +0100

Good question.  I made this observation on Visual C++.  So I had a go on gcc / Intel / 32 bit and it's the other way round - decidely so - and when I look at the code the compiler generates I see that buf [i] = 0.0 is implemented as two 32 bit movl instructions.  Visual C does this in one shot using a scalar SSE instruction.  Also, the gcc memset is very fast so it might be using SSE 128 bit vector instructions in the main loop.
 
All of which just goes to show there's no substitute for a bit of experimentation, which is really what I was trying to say.
 
Regards,
 
Paul Sanders
 
----- Original Message -----
From: Paul Davis
To: Paul Sanders
Cc: Dominik Peklo ; email@hidden
Sent: Wednesday, June 16, 2010 3:48 PM
Subject: Re: long double data type

On Wed, Jun 16, 2010 at 6:37 AM, Paul Sanders
<email@hidden> wrote:

> Bonus question: which is faster? (note that the two buffers are actually the
> same size):
>
> (a) char buf [8192]; memset (buf, 0, 8192);
> (b) double buf [1024]; for (int i = 0; i < 1024; ++i) buf [i] = 0.0;
>
> In fact it is (b), because the code generated uses 64 bit loads and stores.
> Just goes to show there's no substitute for a bit of experimentation.

how many compilers and C libraries have you tested this with?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: long double data type (From: Luigi Castelli <email@hidden>)
 >Re: long double data type (From: Richard Dobson <email@hidden>)
 >Re: long double data type (From: "Paul Sanders" <email@hidden>)
 >Re: long double data type (From: Dominik Peklo <email@hidden>)
 >Re: long double data type (From: "Paul Sanders" <email@hidden>)
 >Re: long double data type (From: Paul Davis <email@hidden>)

  • Prev by Date: Re: long double data type
  • Next by Date: Re: long double data type
  • Previous by thread: Re: long double data type
  • Next by thread: Re: long double data type
  • Index(es):
    • Date
    • Thread