Re: ::select() and threads question, hopefully posed better :-)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com It might give a glue if the two ports are vastly different. mark -- --------------------------------------------------------------------------- Mark F. Murphy, Director Software Development <mailto:markm@tyrell.com> Tyrell Software Corp <http://www.tyrell.com> --------------------------------------------------------------------------- _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... At 12:41 PM -0700 4/11/07, jmzorko@mac.com wrote: I've a bunch of C++ code that runs on Windows and OSX. 99% of the code is portable, and the 1% that isn't mostly has to do with file operations (seeking the POSIX way is slow on Windows, so we had to use the Win32 APIs for that stuff). Anyway, with such a large majority of our code the same across both operating systems, I was expecting to see more-or-less-comparable CPU usage. However, when I run the code, I see the OSX version taking up 4-5x (or more, sometimes 10x) as much CPU as it does under Windows -- this is on my dual 2ghz G5 as well as my 2ghz Core Duo MacBook. Usually when porting apps of this nature and run into issues such as this, you have to look to see if calls are executing in the same way on the new target environment. My guess without seeing your code (and it seems others are guessing this as well)... is that your call to select() is returning a lot more on Mac OS X than it does on your Windows version. Usually when you see CPU being churned in this way, it means there's a tight loop occurring (which may or may not be valid depending on your app). The loop that might be occurring is a return from select() in Mac OS X when such a return would not occur in Windows. In other words, Windows is blocking where as Mac OS X shows different behavior, is not blocking, and returns. Have you compared how many times you're calling select() in Mac OS X versus how many times you call it in Windows? This email sent to site_archiver@lists.apple.com
participants (1)
-
Mark F. Murphy