diff options
| author | Shulhan <m.shulhan@gmail.com> | 2022-08-26 21:48:21 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2023-02-18 16:15:58 +0700 |
| commit | 02b962186be4ed9597df5fc526ef85b2e66cf55b (patch) | |
| tree | 593821d82e835946f306ee9f61a3b666fc387f8a /api/next | |
| parent | 169203f3ee022abf66647abc99fd483fd10f9a54 (diff) | |
| download | go-json-isValidNumber.tar.xz | |
encoding/json: optimize isValidNumber functionjson-isValidNumber
We use an index instead of reslicing the string because reslicing a string
updates both the data and length fields instead of just the one 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 'api/next')
0 files changed, 0 insertions, 0 deletions
