Merge: JSON: optimize writing strings
authorJean Privat <jean@pryen.org>
Thu, 16 Feb 2017 18:06:27 +0000 (13:06 -0500)
committerJean Privat <jean@pryen.org>
Thu, 16 Feb 2017 18:54:56 +0000 (13:54 -0500)
commit17dd44cd6b6ee1359056c3a5ddda7b1107f062b5
tree777c149f8622f6c6579fcf9919bbf27caf614668
parentf63493dbcdd1df4863615465a4fbd15c7df5b74a
parentd0b60980fab037d3108cdd6efa5968bbd53c9000
Merge: JSON: optimize writing strings

Changes how strings are serialized to JSON by grouping non-escaped characters in a single call to write. So if a string has no escape characters, it is written as is. This replaces the old behavior where there was a call to write for each character.

This PR addresses the same issue as #2367 and #2371 but it targets JSON string writing only. The best results are obtained when this PR is merged with #2371. On my machine, parsing and writing `magic.json`  takes the following wall clock time depending on the branch:

* master: 14s
* #2367 (char cache): 6.2s
* #2371 (buffer): 4.0s
* this PR: 4.8s
* this PR + #2371: 3.6s

Pull-Request: #2372