testing: benchmarks moved to separate files

This commit is contained in:
Michał Matczuk committed 2018-05-23 09:39:22 +02:00
1 parent 444d07da6a
commit a8febbc71e
17 files changed
+169 -108

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
package qb
import "testing"
func BenchmarkBatchBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Batch().Add(mockBuilder{"INSERT INTO cycling.cyclist_name (id,user_uuid,firstname) VALUES (?,?,?) ", []string{"id", "user_uuid", "firstname"}}).ToCql()
}
}
-7
View File
@@ -75,10 +75,3 @@ func TestBatchBuilder(t *testing.T) {
}
}
}
func BenchmarkBatchBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Batch().Add(mockBuilder{"INSERT INTO cycling.cyclist_name (id,user_uuid,firstname) VALUES (?,?,?) ", []string{"id", "user_uuid", "firstname"}}).ToCql()
}
}
+25
View File
@@ -0,0 +1,25 @@
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
package qb
import (
"bytes"
"testing"
)
func BenchmarkCmp(b *testing.B) {
buf := bytes.Buffer{}
b.ResetTimer()
for i := 0; i < b.N; i++ {
buf.Reset()
c := cmps{
Eq("id"),
Lt("user_uuid"),
LtOrEq("firstname"),
Gt("stars"),
}
c.writeCql(&buf)
}
}
-15
View File
@@ -155,18 +155,3 @@ func TestCmp(t *testing.T) {
}
}
}
func BenchmarkCmp(b *testing.B) {
buf := bytes.Buffer{}
b.ResetTimer()
for i := 0; i < b.N; i++ {
buf.Reset()
c := cmps{
Eq("id"),
Lt("user_uuid"),
LtOrEq("firstname"),
Gt("stars"),
}
c.writeCql(&buf)
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
package qb
import "testing"
func BenchmarkDeleteBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Delete("cycling.cyclist_name").Columns("id", "user_uuid", "firstname", "stars").Where(Eq("id")).ToCql()
}
}
-7
View File
@@ -72,10 +72,3 @@ func TestDeleteBuilder(t *testing.T) {
}
}
}
func BenchmarkDeleteBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Delete("cycling.cyclist_name").Columns("id", "user_uuid", "firstname", "stars").Where(Eq("id")).ToCql()
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
package qb
import "testing"
func BenchmarkInsertBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Insert("cycling.cyclist_name").Columns("id", "user_uuid", "firstname", "stars").ToCql()
}
}
-7
View File
@@ -77,10 +77,3 @@ func TestInsertBuilder(t *testing.T) {
}
}
}
func BenchmarkInsertBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Insert("cycling.cyclist_name").Columns("id", "user_uuid", "firstname", "stars").ToCql()
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
package qb
import "testing"
func BenchmarkSelectBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Select("cycling.cyclist_name").Columns("id", "user_uuid", "firstname", "stars").Where(Eq("id")).ToCql()
}
}
-7
View File
@@ -106,10 +106,3 @@ func TestSelectBuilder(t *testing.T) {
}
}
}
func BenchmarkSelectBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Select("cycling.cyclist_name").Columns("id", "user_uuid", "firstname", "stars").Where(Eq("id")).ToCql()
}
}
+14
View File
@@ -0,0 +1,14 @@
// Copyright (C) 2017 ScyllaDB
// Use of this source code is governed by a ALv2-style
// license that can be found in the LICENSE file.
package qb
import "testing"
func BenchmarkUpdateBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Update("cycling.cyclist_name").Set("id", "user_uuid", "firstname", "stars").Where(Eq("id")).ToCql()
}
}
-7
View File
@@ -126,10 +126,3 @@ func TestUpdateBuilder(t *testing.T) {
}
}
}
func BenchmarkUpdateBuilder(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
Update("cycling.cyclist_name").Set("id", "user_uuid", "firstname", "stars").Where(Eq("id")).ToCql()
}
}