WordCount performance
Georg Wrede
georg at nospam.org
Thu Mar 27 13:21:39 PDT 2008
Walter Bright wrote:
> I did a little checking.
>
> D's and DMC's isspace(c) checks to see if the input character c is
> ascii. gcc's does not. So there's a little slowdown there, buying
> robustness.
>
> What the real difference is, however, is that D's and DMC's getchar() is
> synchronized for multiple threads. This means that there's a lock/unlock
> going on for *every* single character read.
>
> gcc may not synchronize stdin for multiple threads, or may have found a
> way to avoid the locking if the start-new-thread function in the library
> is never called.
Hmm. What kind of situations would need multiple threads simultaneously
reading from stdin? And if there aren't any, wouldn't locking be like
wearing a life vest on land?
And isspace, is that really the right place to check for ascii?
More information about the Digitalmars-d
mailing list