delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/01/12/02:19:54

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=hAJcMp3Yk/B7HmOi9kkHMdcV8UZaf
7Qk5iX4/FPYDVrWbL+Wjx1mrsU1mK2L3aaGpbb9og8cckkQm1g4/WAjyDsBVFPmj
gXyZsFTuHfMx4/KkX3g3RcgX7w14LCrtuuvl4JtuQZ3blOWouKr+71kvbp1MxWBV
aGOWJXFDjJi7Jc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=YCkH24JF1SLt2c86KB6OVjPoMtQ=; b=I+S
o4XWwvmnNCrJ1eoKjhdguWA7hjLmi0P8UQUReuEt4kls2/Mf90R9/9AN3ail4kCc
CFRZY8Lek6E/BWqwErijN5pkr91kH+K5gM4gb6HQkQtpGgzaKnvIBkGTf9c/NPRs
bX3Q7Pno/UhjhyuU/KUNt/SB1f+f5jtcelzTZowk=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=
X-HELO: mail-it0-f43.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=bGmsKksL3drI3tEiw5bkEQ8Jx43BVR3uwoTIK1olUrQ=; b=FVFhWq+BAG1xkPoqlpq0LdbT7h26e3Y49F7hDSSXsVOyFU4da8Leej0gWS3Ovkm+un TRu2+8ye9UlJtqSzqJHa6S4zAieybQ6JD7GJxQ9v599cYAnBXEoZ5I2eDmagVpMxZb6u 70XxcsVQ7vumOEeZk1eXjVHlsZgAX3xqBcG5YyeRCrqRFUIjVV4JhpAi8ymA3ErZNNKH 1u1fKXqFiU5pinIgJk2Syc2c+wCc0K8GMQKqQHoETdEyBTah6/EECSzn/zCwTTNivTZ9 6p/WJ74w/OOSBVSowZvGYTYLNHw2hDy4oCqi1JWymMVePO0gqsR7CKXigwHjGCOkWfSE MM7g==
X-Gm-Message-State: AKwxytcgOGACoKANbHHnDYqR7mdycpROxvXivae+MYhdVeCn36zyCKUm HKcaNRHSnAlvUQx/BjbvSfGiv1jsXdjY/rGYmHA=
X-Google-Smtp-Source: ACJfBos15iVfjLE0llxGRlNWq/nUwZUE7lj70QFJXF+MAm1NorOZJNBPAReHfm00QadEvZ0XmUiTyJFBxIP1N+8Qfok=
X-Received: by 10.36.160.5 with SMTP id o5mr3728610ite.79.1515741580963; Thu, 11 Jan 2018 23:19:40 -0800 (PST)
MIME-Version: 1.0
From: Lee <ler762 AT gmail DOT com>
Date: Fri, 12 Jan 2018 02:19:40 -0500
Message-ID: <CAD8GWsvxzFe0dPnxO-odTY+EG5XOAApLjcOSN5d7vXhtLW0GmQ@mail.gmail.com>
Subject: calloc speed difference
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019