X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 26 Feb 2013 14:25:44 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: wrong performance of malloc/free under multi-threading Message-ID: <20130226132544.GC2388@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <2265626 DOT 1033831361860540947 DOT herumi AT nifty DOT com> <20130226091403 DOT GB2388 AT calimero DOT vinschen DOT de> <512C9B00 DOT 5040506 AT breisch DOT org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <512C9B00.5040506@breisch.org> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Feb 26 06:22, Chris J. Breisch wrote: > On 2/26/2013 4:14 AM, Corinna Vinschen wrote: > >On Feb 26 15:35, MITSUNARI Shigeo wrote: > >>Hi. > >> > >>I found that the performance of malloc/free is wrong under multi-threading. > >>The following test program reproduces the problem. > >> > >>The program repeats malloc and free under multi-thread. > >>I measured the timing on Cygwin and Linux. > >> > >>timing(sec)| threadNum > >>-----------+----------+------------- > >> | 1 | 2 > >>-----------+----------+------------- > >>Linux | 1.45 | 0.69 > >>-----------+----------+------------- > >>Cygwin | 2.059 | 53.165 > >>-----------+----------+------------- > >> > >>The timing under Linux seems good scale but it is very wrong under Cygwin. > >>Is it intentional behavior or do I use pthread in bad way? > > > >No, you're right. This is easily reproducable. I just had a look and > >it seems that our malloc is really slow in multi-threading scenarios. > >We're using Doug Lea's malloc unchanged with just additional locks > >surrounding the underlying malloc/free calls. > > > >This appears to be a serious performance problem. I just learned that > >glibc uses another version of dlmalloc, called ptmalloc, which is a > >derived version of dlmalloc optimized for multi-threading environments. > > > >Perhaps we have to do the same, but I don't know how long it takes to > >port ptmalloc to Cygwin and obviously I don't know how big the > >performance gain might be. > > > > > >Corinna > > > > Does any host using newlib suffer from this problem, or is it > exclusive to Cygwin? This is Cygwin only. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat -- 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