This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: wrong performance of malloc/free under multi-threading
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 26 Feb 2013 10:14:03 +0100
- Subject: Re: wrong performance of malloc/free under multi-threading
- References: <2265626.1033831361860540947.herumi@nifty.com>
- Reply-to: cygwin at cygwin dot com
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
--
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