On Sat, May 28, 2005 at 02:57:20PM -0400, Christopher Faylor wrote: >On Sat, May 28, 2005 at 01:24:31PM +0200, Vaclav Haisman wrote: >>Somebody mentioned that malloc implementation could be the problem. >>Dunno. I has also crossed my mind that another difference between >>FreeBSD and Cygwin is implementation of C++ exceptions. Maybe the SJLJ >>implementation that Cygwin AFAIK uses has too big overhead. > >To test this theory, I just tried replacing Cygwin's "Unwind" functions >with those from mingw and saw a noticeable speed up in the execution of >this program. I did this by extracting the contents of mingw's libgcc >to a directory and then including unwind-c.o and unwind-sjlj.o on the >command line when linking the test case. I had to modify the test case >by adding these two lines to the bottom: > >int __mingwthr_key_dtor; int _CRT_MT; > >to avoid undefined symbol errors so this is obviously not intended as a >complete solution. > >On doing this, the program went from taking 25 seconds to execute to >taking 7 seconds to execute. That's still 4x slower than mingw but it >is, nonetheless, a noticeable difference. > >Gerrit and Danny do you know what the difference between the mingw and >cygwin implementations of these functions might be?
Two things that I meant to add: - In case it isn't clear, Vaclav's theory is very plausible. - The malloc implementation in Cygwin is Doug Lea's famous malloc implementation. The locking of malloc should be, in the absence of thread contention, accomplished by a the use of a fast InterlockedIncrement/InterlockedDecrement so, even if malloc was being called in this loop (which it isn't), this should not provide excessive overhead. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/