public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* calloc speed difference
@ 2018-01-12  7:19 Lee
  2018-01-12  8:38 ` Eliot Moss
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Lee @ 2018-01-12  7:19 UTC (permalink / raw)
  To: cygwin

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
$i686-w64-mingw32-gcc calloc-test.c
$time ./a

real    0m11.119s
user    0m0.000s
sys     0m0.000s
$gcc calloc-test.c
$time ./a

real    1m12.323s
user    0m0.656s
sys     1m11.640s
$i686-w64-mingw32-gcc calloc-test.c
$time ./a

real    0m11.080s
user    0m0.000s
sys     0m0.000s
$


$ gcc --version
gcc (GCC) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ i686-w64-mingw32-gcc --version
i686-w64-mingw32-gcc (GCC) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--
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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-01-21 11:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12  7:19 calloc speed difference Lee
2018-01-12  8:38 ` Eliot Moss
2018-01-12  9:07 ` Marco Atzeri
2018-01-12 10:52   ` Lee
2018-01-21 11:01     ` Marco Atzeri
2018-01-12 14:05 ` Christian Franke
2018-01-12 14:33   ` Corinna Vinschen
2018-01-12 19:59     ` cyg Simple
2018-01-12 20:07       ` cyg Simple
2018-01-12 20:41       ` Corinna Vinschen
2018-01-12 22:34         ` cyg Simple
2018-01-13 10:48           ` Lee
2018-01-13 10:04     ` Lee
2018-01-12 22:00   ` Eliot Moss
2018-01-13  8:35   ` Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).