gem extracted from chetan's adjustments to json_serialization_benchmark