Currently, all log messages are implemented using streams and manipulators. This is problematic when a function is passed to a log() stream (because the function will be called regardless of the log level or use of NullStreams).
Take, for example, this seemingly innocuous line:
log( pc ) << "finishing on shard " << shard << ", current connection state is " << mdata << endl;
Because mdata is of type ParallelConnectionMetadata, and defines a toString() method which calls toBSON(), we waste CPU time (and malloc/free much more than necessary) even if verbose logging is disabled.
To gauge impact, the supplied patch was applied. A simple stress test which floods mongos with simple find() operations performed 6500 queries per second unpatched, and 7600 queries per second with the patch.