[WIP] lib: optimize util.format()

Optimize util.format() by parsing the format string and generating
specialized code on the fly, then caching the result in a LRU list.

This change is based on the observation that most applications that
log extensively, often have very skewed distributions of log patterns.
It's common to see top 10 or top 25 of popular patterns, followed by
a long (sometimes very long) tail of less popular patterns.

This is a work in progress: the common case is currently 2-25x faster
but the worst case - every pattern unique - is 4-5x slower.

WIP, soliciting comments.