calloc speed difference
Marco Atzeri
marco.atzeri@gmail.com
Fri Jan 12 09:07:00 GMT 2018
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 have roughly the same for both 32 and 64 cygwin version on W7-64
$ time ./calloc-tests
real 0m8.346s
user 0m0.904s
sys 0m7.175s
--
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
More information about the Cygwin
mailing list