Skip to content

Commit d445566

Browse files
committed
Add linestring benchmark
1 parent 69a36ed commit d445566

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

cmd/tile38-benchmark/main.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func main() {
261261
)
262262
}
263263

264-
case "SET", "SET-POINT", "SET-RECT", "SET-STRING":
264+
case "SET", "SET-POINT", "SET-RECT", "SET-LINE", "SET-STRING":
265265
if redis {
266266
redbench.Bench("SET", addr, opts, prepFn,
267267
func(buf []byte) []byte {
@@ -299,6 +299,22 @@ func main() {
299299
)
300300
}
301301
switch strings.ToUpper(strings.TrimSpace(test)) {
302+
case "SET", "SET-LINE":
303+
redbench.Bench("SET (line)", addr, opts, prepFn,
304+
func(buf []byte) []byte {
305+
i := atomic.AddInt64(&i, 1)
306+
alat, alon, blat, blon := randRect(10000)
307+
if rand.Int()%2 == 0 {
308+
alat, alon, blat, blon = blat, blon, alat, alon
309+
}
310+
linestring := fmt.Sprintf(`{"type":"LineString","coordinates":[[%f,%f],[%f,%f]]}`, alon, alat, blon, blat)
311+
return redbench.AppendCommand(buf, "SET", "key:bench", "id:"+strconv.FormatInt(i, 10), "OBJECT",
312+
linestring,
313+
)
314+
},
315+
)
316+
}
317+
switch strings.ToUpper(strings.TrimSpace(test)) {
302318
case "SET", "SET-STRING":
303319
redbench.Bench("SET (string)", addr, opts, prepFn,
304320
func(buf []byte) []byte {

0 commit comments

Comments
 (0)