public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: calloc speed difference
Date: Fri, 12 Jan 2018 20:41:00 -0000	[thread overview]
Message-ID: <20180112204149.GF24623@calimero.vinschen.de> (raw)
In-Reply-To: <b7ab3fe3-fa81-432d-33ad-9c0d7948b044@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1760 bytes --]

On Jan 12 14:59, cyg Simple wrote:
> On 1/12/2018 9:33 AM, Corinna Vinschen wrote:
> > On Jan 12 15:06, Christian Franke wrote:
> >> Timing [cm]alloc() calls without actually using the allocated memory might
> >> produce misleading results due to lazy page allocation and/or zero-filling.
> >>
> >> MinGW binaries use calloc() from msvcrt.dll. This calloc() does not call
> >> malloc() and then memset(). It directly calls:
> >>
> >>   mem = HeapAlloc(_crtheap, HEAP_ZERO_MEMORY, size);
> >>
> >> which possibly only reserves allocate-and-zero-fill-on-demand pages for
> >> later.
> >>
> >> Cygwin's calloc() is different.
> > 
> > But then again, Cygwin's malloc *is* slow, particulary in
> > memory-demanding multi-threaded scenarios since that serializes all
> > malloc/free calls.
> > 
> > The memory handling within Cygwin is tricky.  Attempts to replace good
> > old dlmalloc with a fresher jemalloc or ptmalloc failed, but that only
> > means the developer (i.e., me, in case of ptmalloc) was too lazy...
> > busy! I mean busy... to pull this through.
> > 
> > Having said that, if somebody would like to take a stab at replacing
> > dlmalloc with something leaner, I would be very happy and assist as
> > much as I can.
> 
> Corina, how reliable is the Cygwin time function on a non-Cygwin
> executable?  Isn't this a comparison of apples to oranges?

I wasn't comparing, in fact.  I was just saying that Cygwin's malloc
is slow, partially because dlmalloc is not the fastest one, partially
due to the serialization overhead in multithreading scenarios.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2018-01-12 20:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12  7:19 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180112204149.GF24623@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).