WordCount performance

Sean Kelly sean at invisibleduck.org
Fri Mar 28 12:19:47 PDT 2008


== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> You guys do have a point that perhaps syncing is not needed on stdin.
> But I'm a little leery of removing it, as it is needed for output, and
> I'm not comfortable that this is thought through thoroughly.
> But my other point is that this is an issue with the Digital Mars C
> runtime library, and has nothing whatsoever to do with D or the
> optimizer/backend of D.

Another option might be to check the thread count is greater than
1 and only lock if it is.  Tango has a routine called thread_needLock
for this purpose, though it goes a bit farther and is true once a
thread has been created through program termination.  This avoids
problems with the situation where you have multiple threads running
and all but one terminate but memory is not yet synchronized.


Sean



More information about the Digitalmars-d mailing list