mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
vendor: update github.com/valyala/fastjson from v1.4.5 to v1.5.0
This commit is contained in:
parent
49390b8dbc
commit
4e905d6501
2
go.mod
2
go.mod
@ -9,7 +9,7 @@ require (
|
|||||||
github.com/cespare/xxhash/v2 v2.1.1
|
github.com/cespare/xxhash/v2 v2.1.1
|
||||||
github.com/golang/snappy v0.0.1
|
github.com/golang/snappy v0.0.1
|
||||||
github.com/klauspost/compress v1.10.0
|
github.com/klauspost/compress v1.10.0
|
||||||
github.com/valyala/fastjson v1.4.5
|
github.com/valyala/fastjson v1.5.0
|
||||||
github.com/valyala/fastrand v1.0.0
|
github.com/valyala/fastrand v1.0.0
|
||||||
github.com/valyala/gozstd v1.6.4
|
github.com/valyala/gozstd v1.6.4
|
||||||
github.com/valyala/histogram v1.0.1
|
github.com/valyala/histogram v1.0.1
|
||||||
|
4
go.sum
4
go.sum
@ -114,8 +114,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
|||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
|
github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s=
|
||||||
github.com/valyala/fastjson v1.4.5 h1:uSuLfXk2LzRtzwd3Fy5zGRBe0Vs7zhs11vjdko32xb4=
|
github.com/valyala/fastjson v1.5.0 h1:DGrb4wEYso2HdGLyLmNoyNCQnCWfjd8yhghPv5/5YQg=
|
||||||
github.com/valyala/fastjson v1.4.5/go.mod h1:nV6MsjxL2IMJQUoHDIrjEI7oLyeqK6aBD7EFWPsvP8o=
|
github.com/valyala/fastjson v1.5.0/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
||||||
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
|
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
|
||||||
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||||
github.com/valyala/gozstd v1.6.4 h1:nFLddjEf90SFl5cVWyElSHozQDsbvLljPK703/skBS0=
|
github.com/valyala/gozstd v1.6.4 h1:nFLddjEf90SFl5cVWyElSHozQDsbvLljPK703/skBS0=
|
||||||
|
24
vendor/github.com/valyala/fastjson/fastfloat/parse.go
generated
vendored
24
vendor/github.com/valyala/fastjson/fastfloat/parse.go
generated
vendored
@ -2,8 +2,8 @@ package fastfloat
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ParseUint64BestEffort parses uint64 number s.
|
// ParseUint64BestEffort parses uint64 number s.
|
||||||
@ -95,6 +95,13 @@ func ParseInt64BestEffort(s string) int64 {
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exact powers of 10.
|
||||||
|
//
|
||||||
|
// This works faster than math.Pow10, since it avoids additional multiplication.
|
||||||
|
var float64pow10 = [...]float64{
|
||||||
|
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16,
|
||||||
|
}
|
||||||
|
|
||||||
// ParseBestEffort parses floating-point number s.
|
// ParseBestEffort parses floating-point number s.
|
||||||
//
|
//
|
||||||
// It is equivalent to strconv.ParseFloat(s, 64), but is faster.
|
// It is equivalent to strconv.ParseFloat(s, 64), but is faster.
|
||||||
@ -159,15 +166,13 @@ func ParseBestEffort(s string) float64 {
|
|||||||
if i >= uint(len(s)) {
|
if i >= uint(len(s)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fr := uint64(0)
|
k := i
|
||||||
j := i
|
|
||||||
for i < uint(len(s)) {
|
for i < uint(len(s)) {
|
||||||
if s[i] >= '0' && s[i] <= '9' {
|
if s[i] >= '0' && s[i] <= '9' {
|
||||||
fr = fr*10 + uint64(s[i]-'0')
|
d = d*10 + uint64(s[i]-'0')
|
||||||
i++
|
i++
|
||||||
if i-j > 18 {
|
if i-j >= uint(len(float64pow10)) {
|
||||||
// The fractional part may be out of range for uint64.
|
// The mantissa is out of range. Fall back to standard parsing.
|
||||||
// Fall back to standard parsing.
|
|
||||||
f, err := strconv.ParseFloat(s, 64)
|
f, err := strconv.ParseFloat(s, 64)
|
||||||
if err != nil && !math.IsInf(f, 0) {
|
if err != nil && !math.IsInf(f, 0) {
|
||||||
return 0
|
return 0
|
||||||
@ -178,10 +183,11 @@ func ParseBestEffort(s string) float64 {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if i <= j {
|
if i <= k {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
f += float64(fr) / math.Pow10(int(i-j))
|
// Convert the entire mantissa to a float at once to avoid rounding errors.
|
||||||
|
f = float64(d) / float64pow10[i-k]
|
||||||
if i >= uint(len(s)) {
|
if i >= uint(len(s)) {
|
||||||
// Fast path - parsed fractional number.
|
// Fast path - parsed fractional number.
|
||||||
if minus {
|
if minus {
|
||||||
|
2
vendor/github.com/valyala/fastjson/go.mod
generated
vendored
2
vendor/github.com/valyala/fastjson/go.mod
generated
vendored
@ -1 +1,3 @@
|
|||||||
module github.com/valyala/fastjson
|
module github.com/valyala/fastjson
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -95,7 +95,7 @@ github.com/klauspost/compress/zstd
|
|||||||
github.com/klauspost/compress/zstd/internal/xxhash
|
github.com/klauspost/compress/zstd/internal/xxhash
|
||||||
# github.com/valyala/bytebufferpool v1.0.0
|
# github.com/valyala/bytebufferpool v1.0.0
|
||||||
github.com/valyala/bytebufferpool
|
github.com/valyala/bytebufferpool
|
||||||
# github.com/valyala/fastjson v1.4.5
|
# github.com/valyala/fastjson v1.5.0
|
||||||
github.com/valyala/fastjson
|
github.com/valyala/fastjson
|
||||||
github.com/valyala/fastjson/fastfloat
|
github.com/valyala/fastjson/fastfloat
|
||||||
# github.com/valyala/fastrand v1.0.0
|
# github.com/valyala/fastrand v1.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user