* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
@ 2012-08-09 13:03 Zach Saw
0 siblings, 0 replies; 16+ messages in thread
From: Zach Saw @ 2012-08-09 13:03 UTC (permalink / raw)
To: cygwin
Unfortunately, I'm not paid to minimize test cases for Cygwin.
It already took me quite some time to create the test case to
demonstrate a multicore issue in Cygwin.
And Boost 1.48.0 that I used is officially released as part of Cygwin
(i.e. Cygwin patched - which is different from official Boost).
Another finding - When under WOW64 (Win7-64-bit), the test case fails
(i.e. runs slow) regardless of CPU affinity.
I already found that I could set CPU affinity to fix the issue, so I'm good.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* App runs 8x slower on dual core machine (with test case to replicate issue)
@ 2012-08-09 8:17 Zach Saw
2012-08-09 9:22 ` Corinna Vinschen
2013-01-22 4:51 ` Zach Saw
0 siblings, 2 replies; 16+ messages in thread
From: Zach Saw @ 2012-08-09 8:17 UTC (permalink / raw)
To: cygwin
Hi all,
While trying to compile my multithreaded app written for Linux on
Cygwin to run on Windows, I discovered the app would perform 8x slower
on a machine with the same specs. I then went on to triage the issue
and found that if I set CPU affinity of that process to 1 (i.e. single
core), I'd get it to speed up to almost the speed I'd get under Linux
(set to single core too).
I dug deeper and had my suspicion on a Cygwin bug. I suspected a
problem in its thread singalling (condvar). So to test my hypothesis,
I created a minimal test case to show case this issue. This minimal
test case compiled on MSVC++ too and the difference is staggering.
What you'll find is if you started the process with CPU Aff = 1,
you'll get it to run >8x as fast as the default.
On my machine, it took 4300ms to run in dual core mode, 460ms to run
when CPU Aff = 1.
Setup:
Cygwin
WinXP SP3
2GB RAM
Core2Duo 2.33GHz
All firewalls disabled
Virus / Malware scanners disabled
Boost 1.48.0 (as per official Cygwin installation)
[Only for test case app] Boost.Threadpool - http://threadpool.sourceforge.net
Code to replicate the issue (get Boost.Threadpool from above):
#include <boost/threadpool.hpp>
#include <iostream>
#include <time.h>
inline int GetTickCount()
{
timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return (((int)t.tv_sec) * 1000) + (t.tv_nsec / 1000000);
}
class Test
{
public:
void Add()
{
}
void Delete()
{
}
};
int main(int argc, char** argv)
{
int start;
{
boost::threadpool::pool tp(50);
Test test;
start = GetTickCount();
for (int i=0; i<100000; i++)
{
tp.schedule(boost::bind(&Test::Add, &test));
tp.schedule(boost::bind(&Test::Delete, &test));
}
tp.wait();
}
int elapsed = GetTickCount() - start;
std::cout << elapsed << std::endl;
std::cin.get();
return 0;
}
Cheers,
Zach
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-09 8:17 Zach Saw
@ 2012-08-09 9:22 ` Corinna Vinschen
2012-08-10 3:39 ` Zach Saw
2013-01-22 4:51 ` Zach Saw
1 sibling, 1 reply; 16+ messages in thread
From: Corinna Vinschen @ 2012-08-09 9:22 UTC (permalink / raw)
To: cygwin
On Aug 9 18:07, Zach Saw wrote:
> Hi all,
>
> While trying to compile my multithreaded app written for Linux on
> Cygwin to run on Windows, I discovered the app would perform 8x slower
> on a machine with the same specs. I then went on to triage the issue
> and found that if I set CPU affinity of that process to 1 (i.e. single
> core), I'd get it to speed up to almost the speed I'd get under Linux
> (set to single core too).
>
> I dug deeper and had my suspicion on a Cygwin bug. I suspected a
> problem in its thread singalling (condvar). So to test my hypothesis,
> I created a minimal test case to show case this issue. This minimal
> test case compiled on MSVC++ too and the difference is staggering.
> What you'll find is if you started the process with CPU Aff = 1,
> you'll get it to run >8x as fast as the default.
>
> On my machine, it took 4300ms to run in dual core mode, 460ms to run
> when CPU Aff = 1.
Thanks for the testcase, but... would you mind to change it to take the
boost lib out of the picture, by using just plain pthread functions, if
possible in plain C?
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-09 9:22 ` Corinna Vinschen
@ 2012-08-10 3:39 ` Zach Saw
2012-08-10 3:45 ` Daniel Colascione
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Zach Saw @ 2012-08-10 3:39 UTC (permalink / raw)
To: cygwin
Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> Thanks for the testcase, but... would you mind to change it to take the
> boost lib out of the picture, by using just plain pthread functions, if
> possible in plain C?
Apparently someone else has already encountered similar problems in
cygwin perl
(http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg174491.html)
last year that went unfixed. Now that you have a test case in C++/Boost,
you're asking for plain pthread/C?
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 3:39 ` Zach Saw
@ 2012-08-10 3:45 ` Daniel Colascione
2012-08-10 4:04 ` Zach Saw
2012-08-10 3:52 ` Larry Hall (Cygwin)
2012-08-10 3:56 ` Linda Walsh
2 siblings, 1 reply; 16+ messages in thread
From: Daniel Colascione @ 2012-08-10 3:45 UTC (permalink / raw)
To: cygwin
[-- Attachment #1: Type: text/plain, Size: 912 bytes --]
On 8/9/12 8:29 PM, Zach Saw wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
>
>> Thanks for the testcase, but... would you mind to change it to take the
>> boost lib out of the picture, by using just plain pthread functions, if
>> possible in plain C?
>
> Apparently someone else has already encountered similar problems in
> cygwin perl
> (http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg174491.html)
> last year that went unfixed. Now that you have a test case in C++/Boost,
> you're asking for plain pthread/C?
Cygwin developers are experts in Cygwin, not Perl or Boost. Their job
is hard enough as it is. If you're not interested in being helpful,
I'm sure someone will sell you a support contract.
I don't know what Boost's threadpool uses internally, but if you
consult the source, you should be able to come up with a good testcase
in plain C.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 235 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 3:45 ` Daniel Colascione
@ 2012-08-10 4:04 ` Zach Saw
2012-08-10 16:37 ` Andrew DeFaria
0 siblings, 1 reply; 16+ messages in thread
From: Zach Saw @ 2012-08-10 4:04 UTC (permalink / raw)
To: cygwin
Daniel Colascione <dancol <at> dancol.org> writes:
> Cygwin developers are experts in Cygwin, not Perl or Boost. Their job
> is hard enough as it is. If you're not interested in being helpful,
> I'm sure someone will sell you a support contract.
>
No one said their job is easy. And are *you* paying me to make their job
easier? Keep going with this attitude and see if anyone would be
interested at all in creating test cases or even reporting bugs.
And no support needed, I don't even need to use Cygwin. I found a problem
first time using Cygwin and thought I should report it for the benefit of
the community.
> I don't know what Boost's threadpool uses internally, but if you
> consult the source, you should be able to come up with a good testcase
> in plain C.
>
If you were truly interested in being helpful, you'd have come up with one
already instead of your time wasting reply.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 4:04 ` Zach Saw
@ 2012-08-10 16:37 ` Andrew DeFaria
2012-08-11 1:14 ` Zach Saw
0 siblings, 1 reply; 16+ messages in thread
From: Andrew DeFaria @ 2012-08-10 16:37 UTC (permalink / raw)
To: cygwin
On 08/09/2012 08:56 PM, Zach Saw wrote:
> No one said their job is easy. And are *you* paying me to make their job
> easier?
Do you do everything for a fee?
> Keep going with this attitude and see if anyone would be
> interested at all in creating test cases or even reporting bugs.
Hardly.
--
Andrew DeFaria <http://defaria.com>
Why do ballet dancers always dance on their toes? Wouldn't it be easier
to just hire taller dancers?
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 16:37 ` Andrew DeFaria
@ 2012-08-11 1:14 ` Zach Saw
2012-08-11 2:32 ` Christopher Faylor
0 siblings, 1 reply; 16+ messages in thread
From: Zach Saw @ 2012-08-11 1:14 UTC (permalink / raw)
To: cygwin
Andrew DeFaria <Andrew <at> DeFaria.com> writes:
>
> On 08/09/2012 08:56 PM, Zach Saw wrote:
> > No one said their job is easy. And are *you* paying me to make their job
> > easier?
> Do you do everything for a fee?
Are you a cross dresser and do you change your panties every day?
Well that's right!!! That's none of your business too.
> > Keep going with this attitude and see if anyone would be
> > interested at all in creating test cases or even reporting bugs.
> Hardly.
Troll.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-11 1:14 ` Zach Saw
@ 2012-08-11 2:32 ` Christopher Faylor
0 siblings, 0 replies; 16+ messages in thread
From: Christopher Faylor @ 2012-08-11 2:32 UTC (permalink / raw)
To: cygwin
On Sat, Aug 11, 2012 at 12:45:14AM +0000, Zach Saw wrote:
>Andrew DeFaria writes:
>>On 08/09/2012 08:56 PM, Zach Saw wrote:
>>>No one said their job is easy. And are *you* paying me to make their
>>>job easier?
>>Do you do everything for a fee?
>
>Are you a cross dresser and do you change your panties every day?
>
>Well that's right!!! That's none of your business too.
>
>>>Keep going with this attitude and see if anyone would be interested at
>>>all in creating test cases or even reporting bugs.
>>Hardly.
>
>Troll.
Please stop this. We get it. You were not pleased that someone asked
you you to provide a simple test case. You're not paid to do that. You
made the point a while ago.
You have the gratitude of the Cygwin maintainers for bringing the matter
to our attention. Now, please walk away. Surely no one is paying you
to continue commenting here.
This goes for everyone else too. Unless you want to help debug the
problem, lets let this thread die.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 3:39 ` Zach Saw
2012-08-10 3:45 ` Daniel Colascione
@ 2012-08-10 3:52 ` Larry Hall (Cygwin)
2012-08-10 4:10 ` Zach Saw
2012-08-10 3:56 ` Linda Walsh
2 siblings, 1 reply; 16+ messages in thread
From: Larry Hall (Cygwin) @ 2012-08-10 3:52 UTC (permalink / raw)
To: cygwin
On 8/9/2012 11:29 PM, Zach Saw wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
>
>> Thanks for the testcase, but... would you mind to change it to take the
>> boost lib out of the picture, by using just plain pthread functions, if
>> possible in plain C?
>
> Apparently someone else has already encountered similar problems in
> cygwin perl
> (http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg174491.html)
> last year that went unfixed. Now that you have a test case in C++/Boost,
> you're asking for plain pthread/C?
The easier it is to demonstrate the problem with a minimum of
overhead/code, the quicker the fix. And now that it's reported to the
Cygwin list, the problem is at least on the right radar.
--
Larry
_____________________________________________________________________
A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 3:39 ` Zach Saw
2012-08-10 3:45 ` Daniel Colascione
2012-08-10 3:52 ` Larry Hall (Cygwin)
@ 2012-08-10 3:56 ` Linda Walsh
2012-08-10 4:13 ` Zach Saw
2 siblings, 1 reply; 16+ messages in thread
From: Linda Walsh @ 2012-08-10 3:56 UTC (permalink / raw)
To: cygwin
Zach Saw wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
>> Thanks for the testcase, but... would you mind to change it to take the
>> boost lib out of the picture, by using just plain pthread functions, if
>> possible in plain C?
>
> Apparently someone else has already encountered similar problems in
> cygwin perl
> (http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg174491.html)
--------------
--
I can confirm the perl test case:
Using the referenced prog:
on Linux:
cyg-perl-thread-test.pl
This is perl 5, version 14, subversion 2 (v5.14.2) built for
x86_64-linux-thread-multi
Processing 10 tasks in 1 threads completed in 0.468952secs
Processing 10 tasks in 4 threads completed in 0.156822secs
cat /proc/cpuinfo/Hz|sort |uniq
model name : Intel(R) Xeon(R) CPU X5660 @ 2.80GHz
cpu MHz : 1596.000
On Cygwin:
This is perl 5, version 14, subversion 2 (v5.14.2) built for
cygwin-thread-multi-64int
Processing 10 tasks in 1 threads completed in 1.060806secs
Processing 10 tasks in 4 threads completed in 9.640635secs
/Users/law> cat /proc/cpuinfo|grep Hz|sort -r |uniq
model name : Intel(R) Xeon(R) CPU X5680 @ 3.33GHz
cpu MHz : 3325
---
Note -- neither of my cpu's have "HT" enabled.. So in both
cases 'threads' must use separate processes...
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 3:56 ` Linda Walsh
@ 2012-08-10 4:13 ` Zach Saw
2012-08-10 6:31 ` Zach Saw
0 siblings, 1 reply; 16+ messages in thread
From: Zach Saw @ 2012-08-10 4:13 UTC (permalink / raw)
To: cygwin
Linda Walsh <cygwin <at> tlinx.org> writes:
> I can confirm the perl test case:
>
> Using the referenced prog:
> on Linux:
> cyg-perl-thread-test.pl
> This is perl 5, version 14, subversion 2 (v5.14.2) built for
> x86_64-linux-thread-multi
> Processing 10 tasks in 1 threads completed in 0.468952secs
> Processing 10 tasks in 4 threads completed in 0.156822secs
> cat /proc/cpuinfo/Hz|sort |uniq
> model name : Intel(R) Xeon(R) CPU X5660 @ 2.80GHz
> cpu MHz : 1596.000
>
> On Cygwin:
> This is perl 5, version 14, subversion 2 (v5.14.2) built for
> cygwin-thread-multi-64int
> Processing 10 tasks in 1 threads completed in 1.060806secs
> Processing 10 tasks in 4 threads completed in 9.640635secs
> /Users/law> cat /proc/cpuinfo|grep Hz|sort -r |uniq
> model name : Intel(R) Xeon(R) CPU X5680 @ 3.33GHz
> cpu MHz : 3325
Just out of curiousity are you running XP-32bit?
If you are, could you try running the multithreaded test with CPU
affinity set to 1 (single core)?
You should see it take just a little more time to complete vs the
single threaded one.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-10 4:13 ` Zach Saw
@ 2012-08-10 6:31 ` Zach Saw
0 siblings, 0 replies; 16+ messages in thread
From: Zach Saw @ 2012-08-10 6:31 UTC (permalink / raw)
To: cygwin
Zach Saw <zach.saw <at> gmail.com> writes:
> > On Cygwin:
> > This is perl 5, version 14, subversion 2 (v5.14.2) built for
> > cygwin-thread-multi-64int
>
> Just out of curiousity are you running XP-32bit?
> If you are, could you try running the multithreaded test with CPU
> affinity set to 1 (single core)?
> You should see it take just a little more time to complete vs the
> single threaded one.
Actually, you'd be running under 64-bit Windows with perl being
compiled as native 64-bit app. In which case, could you also try
what I described above?
You should be able to set CPU affinity of the perl process by first
setting affinity of a parent process (e.g. cmd.exe). Then run perl
from that cmd.exe. Child processes will follow the affinity.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: App runs 8x slower on dual core machine (with test case to replicate issue)
2012-08-09 8:17 Zach Saw
2012-08-09 9:22 ` Corinna Vinschen
@ 2013-01-22 4:51 ` Zach Saw
2013-01-22 8:51 ` Corinna Vinschen
1 sibling, 1 reply; 16+ messages in thread
From: Zach Saw @ 2013-01-22 4:51 UTC (permalink / raw)
To: cygwin
Just wondering if there's any updates on this issue.
--
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
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2013-01-22 8:51 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-09 13:03 App runs 8x slower on dual core machine (with test case to replicate issue) Zach Saw
-- strict thread matches above, loose matches on Subject: below --
2012-08-09 8:17 Zach Saw
2012-08-09 9:22 ` Corinna Vinschen
2012-08-10 3:39 ` Zach Saw
2012-08-10 3:45 ` Daniel Colascione
2012-08-10 4:04 ` Zach Saw
2012-08-10 16:37 ` Andrew DeFaria
2012-08-11 1:14 ` Zach Saw
2012-08-11 2:32 ` Christopher Faylor
2012-08-10 3:52 ` Larry Hall (Cygwin)
2012-08-10 4:10 ` Zach Saw
2012-08-10 3:56 ` Linda Walsh
2012-08-10 4:13 ` Zach Saw
2012-08-10 6:31 ` Zach Saw
2013-01-22 4:51 ` Zach Saw
2013-01-22 8:51 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).