diff options
| author | Shulhan <m.shulhan@gmail.com> | 2022-08-26 21:48:21 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2026-02-03 18:04:30 +0700 |
| commit | c4890d155ec1c8992857245260c119be9dc474c0 (patch) | |
| tree | 852f90acc9af069c07fa0abfb98b32c51f77fb08 /src/encoding/binary/binary_test.go | |
| parent | 011e40da85bddf83fee0ded83cb9115b7a88b3d4 (diff) | |
| download | go-c4890d155ec1c8992857245260c119be9dc474c0.tar.xz | |
encoding/json: optimize isValidNumber function
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
Diffstat (limited to 'src/encoding/binary/binary_test.go')
0 files changed, 0 insertions, 0 deletions
