Futher improving writeJSONString
Futher improving writeJSONString

Summary:
Writing to the buffer one char at a time really hurts performance. Most strings
in thrift don't require escaping, so this optimizes for that.

In some workloads it can reach 10x speed improvement.

This prepares a set of chars that need escaping for fast lookups, peeks into the string to
see if escaping is required, and fast-circuits the writes of the chunks that require no escaping.

Reviewed By: yfeldblum

Differential Revision: D10411413

fbshipit-source-id: 4d56a891e370f8672e658ef57cd5eaeb8d26e01b

facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift