Newer
Older
package sqlgen
import (
"testing"
)
func BenchmarkColumn(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = Column{Name: "a"}
func BenchmarkCompileColumnNoCache(b *testing.B) {
_ = (&Column{Name: "a"}).Compile(defaultTemplate)
José Carlos Nieto
committed
func BenchmarkValues(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = Values{{"a"}, {"b"}, {"c"}, {1}, {2}, {3}}
}
}
func BenchmarkCompileValues(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = Values{{"a"}, {"b"}, {"c"}, {1}, {2}, {3}}.Compile(defaultTemplate)
}
}
func BenchmarkValueRaw(b *testing.B) {
for i := 0; i < b.N; i++ {
func BenchmarkColumnValue(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = ColumnValue{Column: Column{Name: "a"}, Operator: "=", Value: NewValue(Raw{Value: "7"})}
José Carlos Nieto
committed
func BenchmarkCompileColumnValue(b *testing.B) {
cv := ColumnValue{Column: Column{Name: "a"}, Operator: "=", Value: NewValue(Raw{Value: "7"})}
José Carlos Nieto
committed
for i := 0; i < b.N; i++ {
cv.Compile(defaultTemplate)
José Carlos Nieto
committed
}
}
func BenchmarkColumnValues(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = NewColumnValues(
ColumnValue{Column: Column{Name: "a"}, Operator: "=", Value: NewValue(Raw{Value: "7"})},
José Carlos Nieto
committed
}
}
func BenchmarkCompileColumnValues(b *testing.B) {
cv := NewColumnValues(ColumnValue{Column: Column{Name: "a"}, Operator: "=", Value: NewValue(Raw{Value: "7"})})
José Carlos Nieto
committed
for i := 0; i < b.N; i++ {
cv.Compile(defaultTemplate)
José Carlos Nieto
committed
}
}
func BenchmarkWhere(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = Where{
&ColumnValue{Column: Column{Name: "baz"}, Operator: "=", Value: NewValue(99)},
José Carlos Nieto
committed
}
}
}
func BenchmarkCompileWhere(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = Where{
&ColumnValue{Column: Column{Name: "baz"}, Operator: "=", Value: NewValue(99)},
José Carlos Nieto
committed
}.Compile(defaultTemplate)
}
}
func BenchmarkTable(b *testing.B) {
for i := 0; i < b.N; i++ {
func BenchmarkCompileSelect(b *testing.B) {
var stmt Statement
for i := 0; i < b.N; i++ {
stmt = Statement{
Type: SqlSelectCount,
&ColumnValue{Column: Column{Name: "a"}, Operator: "=", Value: NewValue(Raw{Value: "7"})},