This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: calloc speed difference


On 1/12/18, Marco Atzeri wrote:
> On 12/01/2018 08:19, Lee wrote:
>> Why is the cygwin gcc calloc so much slower than the
>> i686-w64-mingw32-gcc calloc?
>>    1:12 vs 0:11
>>
>> $cat calloc-test.c
>> #include <stdio.h>
>> #include <stdlib.h>
>> #define ALLOCATION_SIZE (100 * 1024 * 1024)
>> int main (int argc, char *argv[]) {
>>      for (int i = 0; i < 10000; i++) {
>>          void *temp = calloc(ALLOCATION_SIZE, 1);
>>          if ( temp == NULL ) {
>>             printf("drat! calloc returned NULL\n");
>>             return 1;
>>          }
>>          free(temp);
>>      }
>>      return 0;
>> }
>>
>> $gcc calloc-test.c
>> $time ./a
>>
>> real    1m12.459s
>> user    0m0.640s
>> sys     1m11.750s
>
> it seems a local problem, maybe BLODA?

I've seen windows defender get in the way & slow things down before -
this doesn't look anything like that but how does one know for sure?

when running the cygwin gcc version sysinternals process explorer shows
  system idle process 72.x
  a.exe                      24.9x
  procexp64.exe           1.x
and everything else is < 1%
CPU is an Intel i3 w/ 4 logical processors, so I'm guessing that 25%
cpu busy is one processor 100% busy

It looks roughly the same when running the mingw gcc version .. except
that a.exe shows 24.9x% cpu busy for a much shorter time :)

In any case, I tried turning off windows defender - no change in how
long it takes calloc-test to run  (i already had c:\cygwin in the
exclusion list)


> I have roughly the same for both 32 and 64 cygwin version on W7-64

which flavor of gcc - the cygwin version that builds an executable
that pulls in the posix emulation layer or the mingw version that
builds an executable that runs "native" windows code?

Thanks,
Lee

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]