<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/encoding/json/encode.go, branch makepkg</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=makepkg</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=makepkg'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2026-02-03T11:04:30Z</updated>
<entry>
<title>encoding/json: realign struct encodeState, structFields, and field</title>
<updated>2026-02-03T11:04:30Z</updated>
<author>
<name>Shulhan</name>
<email>m.shulhan@gmail.com</email>
</author>
<published>2024-01-24T21:23:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c1b21b3cccfeed8f8f6762410479ac03864cd30c'/>
<id>urn:sha1:c1b21b3cccfeed8f8f6762410479ac03864cd30c</id>
<content type='text'>
This reduce the struct encodeState size from 56 to 16 bytes (-42),
struct structFields size from 40 to 24 bytes (-16), and struct field size
from 136 to 128 bytes (-8).

Benchmark memory profiling before and after,

File: json.test
Type: alloc_space
Time: Jan 25, 2024 at 4:51am (WIB)
Showing nodes accounting for -4.01GB, 4.66% of 85.95GB total
Dropped 64 nodes (cum &lt;= 0.43GB)
      flat  flat%   sum%        cum   cum%
   -4.25GB  4.94%  4.94%    -4.01GB  4.67%  encoding/json.Marshal
    0.19GB  0.22%  4.73%     0.24GB  0.28%  encoding/json.mapEncoder.encode
    0.05GB 0.057%  4.67%     0.05GB 0.057%  reflect.copyVal
    0.04GB 0.049%  4.62%     0.04GB 0.049%  bytes.growSlice
   -0.04GB 0.045%  4.66%    -0.04GB 0.045%  encoding/json.RawMessage.MarshalJSON
         0     0%  4.66%     0.04GB 0.046%  bytes.(*Buffer).WriteString
         0     0%  4.66%     0.04GB 0.049%  bytes.(*Buffer).grow
         0     0%  4.66%    -0.04GB 0.045%  encoding/json.(*Encoder).Encode
         0     0%  4.66%     0.20GB  0.23%  encoding/json.(*encodeState).marshal
         0     0%  4.66%     0.20GB  0.23%  encoding/json.(*encodeState).reflectValue
</content>
</entry>
<entry>
<title>encoding/json: optimize isValidNumber function</title>
<updated>2026-02-03T11:04:30Z</updated>
<author>
<name>Shulhan</name>
<email>m.shulhan@gmail.com</email>
</author>
<published>2022-08-26T14:48:21Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c4890d155ec1c8992857245260c119be9dc474c0'/>
<id>urn:sha1:c4890d155ec1c8992857245260c119be9dc474c0</id>
<content type='text'>
Instead of re-slicing the string for checking the value, use single
index variable.

Benchmark result,

name             old time/op    new time/op    delta
NumberIsValid-8  19.0ns ± 0%    14.5ns ± 1%  -23.70%  (p=0.008 n=5+5)

name             old alloc/op   new alloc/op   delta
NumberIsValid-8   0.00B          0.00B          ~     (all equal)

name             old allocs/op  new allocs/op  delta
NumberIsValid-8    0.00           0.00          ~     (all equal)

Change-Id: I4698c5db134998f83ff47fb3add6a04ba6ec3aa0
</content>
</entry>
<entry>
<title>encoding/json: fix typo in package doc.</title>
<updated>2026-01-24T02:08:03Z</updated>
<author>
<name>David Symonds</name>
<email>dsymonds@golang.org</email>
</author>
<published>2026-01-22T00:25:18Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=f8b72802d7a7dd2bcb81bdaead80be802e16351b'/>
<id>urn:sha1:f8b72802d7a7dd2bcb81bdaead80be802e16351b</id>
<content type='text'>
Change-Id: Id5520757e4d73e56e533e4de4f5f303105c4339e
Reviewed-on: https://go-review.googlesource.com/c/go/+/738180
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
Auto-Submit: David Symonds &lt;dsymonds@golang.org&gt;
Reviewed-by: Carlos Amedee &lt;carlos@golang.org&gt;
Reviewed-by: David Symonds &lt;dsymonds@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Joseph Tsai &lt;joetsai@digital-static.net&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: remove unneeded unsafe import</title>
<updated>2026-01-22T22:29:44Z</updated>
<author>
<name>khr@golang.org</name>
<email>khr@golang.org</email>
</author>
<published>2025-12-23T15:41:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=26ffe78b8c34cea92a06690742b5d41b3397105f'/>
<id>urn:sha1:26ffe78b8c34cea92a06690742b5d41b3397105f</id>
<content type='text'>
Followon for CL 721160.

Change-Id: I9c22c5e99c9084e24047c77d20717c5b46165cde
Reviewed-on: https://go-review.googlesource.com/c/go/+/732220
Reviewed-by: Carlos Amedee &lt;carlos@golang.org&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Sean Liao &lt;sean@liao.dev&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: remove linknames</title>
<updated>2025-11-20T22:04:37Z</updated>
<author>
<name>Sean Liao</name>
<email>sean@liao.dev</email>
</author>
<published>2025-11-17T19:16:37Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=a662badab918d7708bbc750f24b9c7313520e2b0'/>
<id>urn:sha1:a662badab918d7708bbc750f24b9c7313520e2b0</id>
<content type='text'>
The linknames have been removed in the latest commits:

isValidNumber, typeFields:
https://github.com/bytedance/sonic/commit/908af5dfaf7d509db1f2c2b1c43f4df728db80a6

unquoteBytes:
https://github.com/bytedance/sonic/commit/8e9090a84be10962046197f1867d297d3e73020a

For #67401

Change-Id: I30b057137932fcf267014ab5470c417298765249
Reviewed-on: https://go-review.googlesource.com/c/go/+/721160
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Junyang Shao &lt;shaojunyang@google.com&gt;
Reviewed-by: Mark Freeman &lt;markfreeman@google.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: use reflect.TypeAssert</title>
<updated>2025-09-10T00:22:28Z</updated>
<author>
<name>Joe Tsai</name>
<email>joetsai@digital-static.net</email>
</author>
<published>2025-06-22T04:01:32Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=e6605a1bcc56523c0168caf765399dede7d3d1e4'/>
<id>urn:sha1:e6605a1bcc56523c0168caf765399dede7d3d1e4</id>
<content type='text'>
Updates #62121

Change-Id: Ic3c4fe84a5dacfd8270aba0d5dd59f83f0a9030f
Reviewed-on: https://go-review.googlesource.com/c/go/+/701955
Reviewed-by: Mark Freeman &lt;markfreeman@google.com&gt;
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: add security section to doc</title>
<updated>2025-06-27T20:38:47Z</updated>
<author>
<name>Roland Shoemaker</name>
<email>roland@golang.org</email>
</author>
<published>2025-06-26T19:19:23Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2a22aefa1f7befb0ac7a95c918b75b05919c1907'/>
<id>urn:sha1:2a22aefa1f7befb0ac7a95c918b75b05919c1907</id>
<content type='text'>
Add a section to the package doc which details the security
considerations of using encoding/json, in particular with respect to
parser misalignment issues.

Additionally, clarify previously ambiguous statement in the Unmarshal
doc about how case is used when matching keys in objects, and add a note
about how duplicate keys are handled.

Fixes #14750

Change-Id: I66f9b845efd98c86a684d7333b3aa8a456564922
Reviewed-on: https://go-review.googlesource.com/c/go/+/684315
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Auto-Submit: Roland Shoemaker &lt;roland@golang.org&gt;
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: avoid supurious synctest deadlock detection</title>
<updated>2025-05-20T22:46:07Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2025-05-15T18:03:15Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=68bc0d84e9dd74a02472bfff744e0650b4b1653c'/>
<id>urn:sha1:68bc0d84e9dd74a02472bfff744e0650b4b1653c</id>
<content type='text'>
Use a sync.OnceValue rather than a sync.WaitGroup to
coordinate access to encoderCache entries.

The OnceValue better expresses the intent of the code
(we want to initialize the cache entry only once).

However, the motivation for this change is to avoid
testing/synctest incorrectly reporting a deadlock
when multiple bubbles call Marshal at the same time.
Goroutines blocked on WaitGroup.Wait are "durably blocked",
causing confusion when a goroutine in one bubble Waits
for a goroutine in a different bubble. Goroutines blocked
on OnceValue are not durably blocked, avoiding the problem.

Fixes #73733
For #67434

Change-Id: I81cddda80af67cf5c280fd4327620bc37e7a6fe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/673335
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: add json/v2 with GOEXPERIMENT=jsonv2 guard</title>
<updated>2025-04-18T15:24:07Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2025-04-11T21:19:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=0e17905793cb5e0acc323a0cdf3733199d93976a'/>
<id>urn:sha1:0e17905793cb5e0acc323a0cdf3733199d93976a</id>
<content type='text'>
This imports the proposed new v2 JSON API implemented in
github.com/go-json-experiment/json as of commit
d3c622f1b874954c355e60c8e6b6baa5f60d2fed.

When GOEXPERIMENT=jsonv2 is set, the encoding/json/v2 and
encoding/jsontext packages are visible, the encoding/json
package is implemented in terms of encoding/json/v2, and
the encoding/json package include various additional APIs.
(See #71497 for details.)

When GOEXPERIMENT=jsonv2 is not set, the new API is not
present and the encoding/json package is unchanged.

The experimental API is not bound by the Go compatibility
promise and is expected to evolve as updates are made to
the json/v2 proposal.

The contents of encoding/json/internal/jsontest/testdata
are compressed with zstd v1.5.7 with the -19 option.

Fixes #71845
For #71497

Change-Id: Ib8c94e5f0586b6aaa22833190b41cf6ef59f4f01
Reviewed-on: https://go-review.googlesource.com/c/go/+/665796
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
</content>
</entry>
<entry>
<title>encoding/json: use builtin min function in appendString</title>
<updated>2025-02-25T19:49:13Z</updated>
<author>
<name>Jes Cok</name>
<email>xigua67damn@gmail.com</email>
</author>
<published>2025-02-21T14:18:52Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=97571f36103b045a7e9c15a92e9a35ab95fa6be5'/>
<id>urn:sha1:97571f36103b045a7e9c15a92e9a35ab95fa6be5</id>
<content type='text'>
To make code a bit simpler.

Change-Id: I59fca1d5760e304abd53873ecf9ca8b2903e02e8
GitHub-Last-Rev: 1369df6da16121c342a4e678efe3e5b082485b74
GitHub-Pull-Request: golang/go#71873
Reviewed-on: https://go-review.googlesource.com/c/go/+/651355
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
</content>
</entry>
</feed>
