That's interesting - I think we could do that incrementally even.
One of the goals of the BufferWriter formatting effort was to improve performance for debugging messages as well, mainly by avoiding local argument formatting if the trace wasn't enabled. IP addresses are the classic example - to pass them to printf() you need to call inet_ntoa before printf and therefore before checking the enable flag. BWF lets you check the flag first, and then do the formatting. You could do a local if on the flag, then convert, then call the trace (which is done in some places) but it seems better to automate that.