mirror of https://github.com/tidwall/tile38.git
Add linestring benchmark
This commit is contained in:
parent
69a36ed176
commit
d445566c06
|
@ -261,7 +261,7 @@ func main() {
|
|||
)
|
||||
}
|
||||
|
||||
case "SET", "SET-POINT", "SET-RECT", "SET-STRING":
|
||||
case "SET", "SET-POINT", "SET-RECT", "SET-LINE", "SET-STRING":
|
||||
if redis {
|
||||
redbench.Bench("SET", addr, opts, prepFn,
|
||||
func(buf []byte) []byte {
|
||||
|
@ -299,6 +299,22 @@ func main() {
|
|||
)
|
||||
}
|
||||
switch strings.ToUpper(strings.TrimSpace(test)) {
|
||||
case "SET", "SET-LINE":
|
||||
redbench.Bench("SET (line)", addr, opts, prepFn,
|
||||
func(buf []byte) []byte {
|
||||
i := atomic.AddInt64(&i, 1)
|
||||
alat, alon, blat, blon := randRect(10000)
|
||||
if rand.Int()%2 == 0 {
|
||||
alat, alon, blat, blon = blat, blon, alat, alon
|
||||
}
|
||||
linestring := fmt.Sprintf(`{"type":"LineString","coordinates":[[%f,%f],[%f,%f]]}`, alon, alat, blon, blat)
|
||||
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "OBJECT",
|
||||
linestring,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
switch strings.ToUpper(strings.TrimSpace(test)) {
|
||||
case "SET", "SET-STRING":
|
||||
redbench.Bench("SET (string)", addr, opts, prepFn,
|
||||
func(buf []byte) []byte {
|
||||
|
|
Loading…
Reference in New Issue