X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=VzivhHv9cvFys3avF1YV5aA3SdPq0dA7KYomKLq/KhM=; b=cpOHyhszpTTuuApHww7QunexnJ1YAj1gchM0MT393txU2HU2aYZ5fN7bTsw/GZC5My aA7jEEX5c+3jxU0nkLyPS5Z5ibnG0TlEBgsthAbpgrakYCjeUc64p29yhUNqGoF6WA4y aFgvMuWKFY1ON7getCSylZicvvOztTseA1eHb1luuSB0VJTtGW05q0RrM1blJyUVPlBg m1D+0QbpraDAG1Ycu/2iLZLD6Lu6ZKX25+xZkn3BTDYyqyKbne2dF8EVNR/3x3Oz9blS snOOGZtA5KFVVysBUGW6bzgMEZZcHyNwDWTc0ecvMni0l1Uzd/Dl6RWD0kcyUvrv4Wg/ H85g== X-Received: by 10.182.12.39 with SMTP id v7mr10836603obb.47.1361877764148; Tue, 26 Feb 2013 03:22:44 -0800 (PST) Message-ID: <512C9B00.5040506@breisch.org> Date: Tue, 26 Feb 2013 06:22:40 -0500 From: "Chris J. Breisch" User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: wrong performance of malloc/free under multi-threading References: <2265626 DOT 1033831361860540947 DOT herumi AT nifty DOT com> <20130226091403 DOT GB2388 AT calimero DOT vinschen DOT de> In-Reply-To: <20130226091403.GB2388@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmB9GQuswF4IpPYkCKNhLROATX2I/Pry2p7sBGsxjbX1sUgHjzRzNY5l03Cw91evCNvE0Ig X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 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? Chris -- In theory, there's no difference between theory and practice. In practice, there is. -- 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