X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=0.1 required=5.0	tests=AWL,BAYES_05,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_PASS,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Magnus Holmgren <magnushol@gmail.com>
Subject: Re: Cygwin slow on x64 systems
Date: Wed, 1 Sep 2010 17:12:19 +0000 (UTC)
Lines: 38
Message-ID: <loom.20100901T190726-553@post.gmane.org>
References: <4C7B9327.9030204@graphtech.co.il> <loom.20100831T222419-914@post.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Magnus Holmgren <magnushol <at> gmail.com> writes:

> I did some testing on my 64-bit Vista system, and it appears that 
> CreateThread is the main cause.

I think I've found the reason for the slow CreateThread. It seems like
the following remark in the MSDN documentation is relevant, at least for
WOW64 processes:

 * During process startup and DLL initialization routines, new threads can
   be created, but they do not begin execution until DLL initialization is
   done for the process.

To test this, I removed the call to sigproc_init in dll_crt0_0 and made sure 
it was always called in dll_crt0_1 instead. Suddenly the sigp thread started 
executing immediately, and its initialization was complete long before 
wait_for_sigthread was called.

Even with this change, a "date loop" isn't blazingly fast on my computer
(cygwin1.dll created from 1.7.7 sources, first number is executions per
second):

     26 Wed Sep  1 18:47:36 WEDT 2010
     27 Wed Sep  1 18:47:37 WEDT 2010
     26 Wed Sep  1 18:47:38 WEDT 2010

But it is a clear improvement (using the stock 1.7.6 dll):

      9 Wed Sep  1 18:52:35 WEDT 2010
      9 Wed Sep  1 18:52:36 WEDT 2010
      9 Wed Sep  1 18:52:37 WEDT 2010

PS. There are a few trace printfs in cygthread::create that uses "name" in 
the argument list to print the thread name. That doesn't work nearly as well 
as "__name". :)

  Magnus



--
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

