> But there's still a difference, right? And when called or passed through alot, > that small difference can become really big. ... > The fwrite was just an example. We actually do our debugging through memory > first (ofcourse, there's still locking) and then another debugger thread does > the writing so the real application threads do not have to block on the IO.
Let me put it this way: the difference is small enough that if you were logging often enough for it to be a problem, then I you might well be filling your hard disk with the log file ;-) Actually, have you benchmarked to see how much you gain by not using fwrite directly? I considered this approach, and then dropped it when I saw the actual performance. Remember, if you're not forcing fsync, then your write is buffered and you're not waiting for a disk write. Of course you are still calling into the kernel and dealing with locking and communications between process, so it is indeed faster to push something on to an in-process queue--just not as a big a difference as I had expected. And of course the other problem is that by having a background thread writing out queued log messages, if your thread bug causes a crash, you'll lose some number of the most recent log messages. That's what convinced me in the end to go ahead and write directly--I needed the most recent messages I could possibly get. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com