This came up yesterday on the IRC. The problem is that every call to TSMimeHdrFieldNext allocates a MIME field handle which gets very slow if you use the function heavily. One suggested approach was to switch the allocator from a global to a per thread.
I think it might be better to add TSMimeHdrFieldHandleNext() which updates the MIME field handle in place. Does this seem like a reasonable API addition?