mirror of https://github.com/tidwall/tile38.git
distinct benchmark types
the -t flag now supports set-point, set-rect, and set-string
This commit is contained in:
parent
cb062bded4
commit
91c44a5eef
|
@ -177,7 +177,7 @@ func main() {
|
||||||
return redbench.AppendCommand(buf, "PING")
|
return redbench.AppendCommand(buf, "PING")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
case "SET":
|
case "SET", "SET-POINT", "SET-RECT", "SET-STRING":
|
||||||
if redis {
|
if redis {
|
||||||
redbench.Bench("SET", addr, fillOpts(), prepFn,
|
redbench.Bench("SET", addr, fillOpts(), prepFn,
|
||||||
func(buf []byte) []byte {
|
func(buf []byte) []byte {
|
||||||
|
@ -186,34 +186,43 @@ func main() {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
var i int64
|
var i int64
|
||||||
redbench.Bench("SET (point)", addr, fillOpts(), prepFn,
|
switch strings.ToUpper(strings.TrimSpace(test)) {
|
||||||
func(buf []byte) []byte {
|
case "SET", "SET-POINT":
|
||||||
i := atomic.AddInt64(&i, 1)
|
redbench.Bench("SET (point)", addr, fillOpts(), prepFn,
|
||||||
lat, lon := randPoint()
|
func(buf []byte) []byte {
|
||||||
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "POINT",
|
i := atomic.AddInt64(&i, 1)
|
||||||
strconv.FormatFloat(lat, 'f', 5, 64),
|
lat, lon := randPoint()
|
||||||
strconv.FormatFloat(lon, 'f', 5, 64),
|
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "POINT",
|
||||||
)
|
strconv.FormatFloat(lat, 'f', 5, 64),
|
||||||
},
|
strconv.FormatFloat(lon, 'f', 5, 64),
|
||||||
)
|
)
|
||||||
redbench.Bench("SET (rect)", addr, fillOpts(), prepFn,
|
},
|
||||||
func(buf []byte) []byte {
|
)
|
||||||
i := atomic.AddInt64(&i, 1)
|
}
|
||||||
minlat, minlon, maxlat, maxlon := randRect()
|
switch strings.ToUpper(strings.TrimSpace(test)) {
|
||||||
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "BOUNDS",
|
case "SET", "SET-RECT":
|
||||||
strconv.FormatFloat(minlat, 'f', 5, 64),
|
redbench.Bench("SET (rect)", addr, fillOpts(), prepFn,
|
||||||
strconv.FormatFloat(minlon, 'f', 5, 64),
|
func(buf []byte) []byte {
|
||||||
strconv.FormatFloat(maxlat, 'f', 5, 64),
|
i := atomic.AddInt64(&i, 1)
|
||||||
strconv.FormatFloat(maxlon, 'f', 5, 64),
|
minlat, minlon, maxlat, maxlon := randRect()
|
||||||
)
|
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "BOUNDS",
|
||||||
},
|
strconv.FormatFloat(minlat, 'f', 5, 64),
|
||||||
)
|
strconv.FormatFloat(minlon, 'f', 5, 64),
|
||||||
redbench.Bench("SET (string)", addr, fillOpts(), prepFn,
|
strconv.FormatFloat(maxlat, 'f', 5, 64),
|
||||||
func(buf []byte) []byte {
|
strconv.FormatFloat(maxlon, 'f', 5, 64),
|
||||||
i := atomic.AddInt64(&i, 1)
|
)
|
||||||
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "STRING", "xxx")
|
},
|
||||||
},
|
)
|
||||||
)
|
}
|
||||||
|
switch strings.ToUpper(strings.TrimSpace(test)) {
|
||||||
|
case "SET", "SET-STRING":
|
||||||
|
redbench.Bench("SET (string)", addr, fillOpts(), prepFn,
|
||||||
|
func(buf []byte) []byte {
|
||||||
|
i := atomic.AddInt64(&i, 1)
|
||||||
|
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "STRING", "xxx")
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "GET":
|
case "GET":
|
||||||
if redis {
|
if redis {
|
||||||
|
|
Loading…
Reference in New Issue