Small part of a program : d and c versions performances diff.

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 9 16:01:33 PDT 2014


On 07/09/2014 12:47 PM, Larry wrote:

 > On Wednesday, 9 July 2014 at 18:18:43 UTC, Ali Çehreli wrote:
 >> On 07/09/2014 03:57 AM, Larry wrote:
 >>
 >> >      struct timeval s,e;
 >> [...]
 >> >      gettimeofday(&e,NULL);
 >> >
 >> >      printf("so ? %d %lu %d %d %d",g,e.tv_usec - s.tv_usec,
 >> > arr[4],arr[9],pol);
 >>
 >> Changing the topic a little, the calculation above ignores the tv_sec
 >> members of s and e.
 >>
 >> Ali
 >
 > Absolutely Ali because I know it is under the sec range. I made some
 > test before submitting it :)

I know it did work and will work every time you test it. :)

However, even if the difference is just one millisecond, if s and e 
happen to be on different sides of a second boundary, you will get a 
huge result.

Ali



More information about the Digitalmars-d-learn mailing list