[quoted lines by Nicolas Pitre on 2012/05/26 at 23:31 +0800] >Secondly, looking at logRouting(), it might be a good idea to push >vsprintf usage down into logMessage(), or alternatively to move the log >level test up, so to avoid wasted CPU cycles doing string formatting if >the log level is too low and the formatted string won't be used in the >end.
I've gone half way. :-) The only formatting logRouting() does now is to prepend the "cursor routing:" prefix. It then calls vlogMessage(), which defers the formatting to logData(), which only does it if the log level is sufficient. In the end, I don't think maximum efficiency matters all that much since that code is only executed if the cursor routing category is enabled, and that'd only ever be for very specialized debugging. If we really want to make it even mroe efficient then all we need do is replicate the "cursor routing" prefix for each call, which could easily be done with a #define. That'd be a lot cleaner than duplicating all of the log level and category definitions. I don't really think that extra level of efficiency will gain much, though, and significant added complexity for little gain is rarely worth it. -- Dave Mielke | 2213 Fox Crescent | The Bible is the very Word of God. Phone: 1-613-726-0014 | Ottawa, Ontario | 2011 May 21 is the End of Salvation. EMail: [email protected] | Canada K2A 1H7 | http://Mielke.cc/now.html http://FamilyRadio.com/ | http://Mielke.cc/bible/ _______________________________________________ This message was sent via the BRLTTY mailing list. To post a message, send an e-mail to: [email protected] For general information, go to: http://mielke.cc/mailman/listinfo/brltty
