spray/spray-json — pull request #105 by tootedom (2014-05-09 19:31:54+00:00)
Title: + jsonFormat : allow user to choose between ordered and unordered key/values

Hi there,

As per the post here: https://groups.google.com/forum/#!topic/spray-user/bDiqD1Xfxls

I've made changes that can use Map in a JsObject, over ListMap, when the user does not require the ordering of the attributes to appear in the same order as they appear in the domain/marshalled object; as the ordering of keys in an object in json isn't required (ordering is only required by Arrays as per the JSON.org specs).

The below image shows a ~7 min run of our load test, with Ordered elements (ListMap):

![listmapallocation](https://cloud.githubusercontent.com/assets/211070/2932378/b6e8a62a-d7af-11e3-9be4-d471b6993f7a.png)

The following is the same load test, but with this pull request to allow for a `jsonUnorderedFormat` formatters:

![mapreducedallocations](https://cloud.githubusercontent.com/assets/211070/2932385/de813742-d7af-11e3-8684-1fe32a40c49f.png)

the diagram shows the ~40gb drop in allocations as a result of using Map over ListMap; which is close 40% drop in allocations for the marshalling.

Apologies, I couldn't easily see an easy way to add a boolean to the existing `jsonFormat` templates; to control the ordering, so I just went for the explicit `jsonUnorderedFormat` approach.

thanks
/dom