summaryrefslogtreecommitdiff
path: root/src/encoding/json/stream_test.go
Commit message (Collapse)AuthorAgeFilesLines
* encoding/json: parallelize most benchmarksBryan C. Mills2017-04-261-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't bother with BenchmarkDecoderStream — it's doing something subtle with the input buffer that isn't easy to replicate in a parallel test. Results remain comparable with the non-parallel version with -cpu=1: benchmark old ns/op new ns/op delta BenchmarkCodeEncoder 22815832 21058729 -7.70% BenchmarkCodeEncoder-6 22190561 3579757 -83.87% BenchmarkCodeMarshal 25356621 25396429 +0.16% BenchmarkCodeMarshal-6 25359813 4944908 -80.50% BenchmarkCodeDecoder 94794556 88016360 -7.15% BenchmarkCodeDecoder-6 93795028 16726283 -82.17% BenchmarkDecoderStream 532 583 +9.59% BenchmarkDecoderStream-6 598 550 -8.03% BenchmarkCodeUnmarshal 97644168 89162504 -8.69% BenchmarkCodeUnmarshal-6 96615302 17036419 -82.37% BenchmarkCodeUnmarshalReuse 91747073 90298479 -1.58% BenchmarkCodeUnmarshalReuse-6 89397165 15518005 -82.64% BenchmarkUnmarshalString 808 843 +4.33% BenchmarkUnmarshalString-6 912 220 -75.88% BenchmarkUnmarshalFloat64 695 732 +5.32% BenchmarkUnmarshalFloat64-6 710 191 -73.10% BenchmarkUnmarshalInt64 635 640 +0.79% BenchmarkUnmarshalInt64-6 618 185 -70.06% BenchmarkIssue10335 916 947 +3.38% BenchmarkIssue10335-6 879 216 -75.43% BenchmarkNumberIsValid 34.7 34.3 -1.15% BenchmarkNumberIsValid-6 34.9 36.7 +5.16% BenchmarkNumberIsValidRegexp 1174 1121 -4.51% BenchmarkNumberIsValidRegexp-6 1134 1119 -1.32% BenchmarkSkipValue 20506938 20708060 +0.98% BenchmarkSkipValue-6 21627665 22375630 +3.46% BenchmarkEncoderEncode 690 726 +5.22% BenchmarkEncoderEncode-6 649 157 -75.81% benchmark old MB/s new MB/s speedup BenchmarkCodeEncoder 85.05 92.15 1.08x BenchmarkCodeEncoder-6 87.45 542.07 6.20x BenchmarkCodeMarshal 76.53 76.41 1.00x BenchmarkCodeMarshal-6 76.52 392.42 5.13x BenchmarkCodeDecoder 20.47 22.05 1.08x BenchmarkCodeDecoder-6 20.69 116.01 5.61x BenchmarkCodeUnmarshal 19.87 21.76 1.10x BenchmarkCodeUnmarshal-6 20.08 113.90 5.67x BenchmarkSkipValue 90.55 89.67 0.99x BenchmarkSkipValue-6 90.83 87.80 0.97x benchmark old allocs new allocs delta BenchmarkIssue10335 4 4 +0.00% BenchmarkIssue10335-6 4 4 +0.00% BenchmarkEncoderEncode 1 1 +0.00% BenchmarkEncoderEncode-6 1 1 +0.00% benchmark old bytes new bytes delta BenchmarkIssue10335 320 320 +0.00% BenchmarkIssue10335-6 320 320 +0.00% BenchmarkEncoderEncode 8 8 +0.00% BenchmarkEncoderEncode-6 8 8 +0.00% updates #18177 Change-Id: Ia4f5bf5ac0afbadb1705ed9f9e1b39dabba67b40 Reviewed-on: https://go-review.googlesource.com/36724 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* encoding/json: rename Indent method to SetIndentRuss Cox2016-05-241-1/+4
| | | | | | | | | | | | | | | | | | | | | CL 21057 added this method during the Go 1.7 cycle (so it is not yet released and still possible to revise). This makes it clearer that the method is not doing something (like func Indent does), but just changing a setting about doing something later. Also document that this is in some sense irreversible. I think that's probably a mistake but the original CL discussion claimed it as a feature, so I'll leave it alone. For #6492. Change-Id: If4415c869a9196501056c143811a308822d5a420 Reviewed-on: https://go-review.googlesource.com/23295 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
* encoding/json: change DisableHTMLEscaping to SetEscapeHTMLRuss Cox2016-05-241-4/+4
| | | | | | | | | | | | DisableHTMLEscaping is now SetEscapeHTML, allowing the escaping to be toggled, not just disabled. This API is new for Go 1.7, so there are no compatibility concerns (quite the opposite, the point is to fix the API before we commit to it in Go 1.7). Change-Id: I96b9f8f169a9c44995b8a157a626eb62d0b6dea7 Reviewed-on: https://go-review.googlesource.com/23293 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
* encoding/json: add Encoder.DisableHTMLEscapingCaleb Spare2016-04-221-0/+33
| | | | | | | | | | | | | This provides a way to disable the escaping of <, >, and & in JSON strings. Fixes #14749. Change-Id: I1afeb0244455fc8b06c6cce920444532f229555b Reviewed-on: https://go-review.googlesource.com/21796 Run-TryBot: Caleb Spare <cespare@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* encoding/json: add (*Encoder).IndentCaleb Spare2016-03-251-0/+30
| | | | | | | | | Fixes #6492. Change-Id: Ibc633c43a6d134bb140addb59780a5758b35a5c5 Reviewed-on: https://go-review.googlesource.com/21057 Run-TryBot: Caleb Spare <cespare@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* encoding/json: test style tweaksBrad Fitzpatrick2015-07-281-18/+11
| | | | | | | | Rename test name from Http to HTTP, and fix some style nits. Change-Id: I00fe1cecd69ca2f50be86a76ec90031c2f921707 Reviewed-on: https://go-review.googlesource.com/12760 Reviewed-by: Andrew Gerrand <adg@golang.org>
* encoding/json: fix EOF bug decoding HTTP streamPeter Waldschmidt2015-07-281-0/+44
| | | | | | | | | Fixes bug referenced in this thread on golang-dev: https://groups.google.com/d/topic/golang-dev/U4LSpMzL82c/discussion Change-Id: If01a2644863f9e5625dd2f95f9d344bda772e12c Reviewed-on: https://go-review.googlesource.com/12726 Reviewed-by: Russ Cox <rsc@golang.org>
* encoding/json: add JSON streaming parse APIPeter Waldschmidt2015-07-271-0/+111
| | | | | | | | | | | | | | | This change adds new methods to Decoder. * Decoder.Token steps through a JSON document, returning a value for each token. * Decoder.Decode unmarshals the entire value at the token stream's current position (in addition to its existing function in a stream of JSON values) Fixes #6050. Fixes #6499. Change-Id: Iff283e0e7b537221ae256392aca6529f06ebe211 Reviewed-on: https://go-review.googlesource.com/9073 Reviewed-by: Russ Cox <rsc@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+206
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.