MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / BenchmarkCreateTableStatementPool

Function BenchmarkCreateTableStatementPool

pkg/sql/ast/pool_ddl_test.go:943–980  ·  view source on GitHub ↗

============================================================ Benchmarks ============================================================

(b *testing.B)

Source from the content-addressed store, hash-verified

941// ============================================================
942
943func BenchmarkCreateTableStatementPool(b *testing.B) {
944 b.Run("GetPutCreateTableStatement", func(b *testing.B) {
945 b.ReportAllocs()
946 for i := 0; i < b.N; i++ {
947 stmt := GetCreateTableStatement()
948 stmt.Name = "users"
949 stmt.IfNotExists = true
950 stmt.Columns = append(stmt.Columns, ColumnDef{
951 Name: "id",
952 Type: "BIGINT",
953 Constraints: []ColumnConstraint{
954 {Type: "NOT NULL", Default: &LiteralValue{Value: "0"}},
955 },
956 })
957 PutCreateTableStatement(stmt)
958 }
959 })
960
961 b.Run("AllocCreateTableStatement", func(b *testing.B) {
962 b.ReportAllocs()
963 for i := 0; i < b.N; i++ {
964 stmt := &CreateTableStatement{
965 Name: "users",
966 IfNotExists: true,
967 Columns: []ColumnDef{
968 {
969 Name: "id",
970 Type: "BIGINT",
971 Constraints: []ColumnConstraint{
972 {Type: "NOT NULL", Default: &LiteralValue{Value: "0"}},
973 },
974 },
975 },
976 }
977 _ = stmt
978 }
979 })
980}
981
982func BenchmarkAlterTableStatementPool(b *testing.B) {
983 b.Run("GetPutAlterTableStatement", func(b *testing.B) {

Callers

nothing calls this directly

Calls 3

GetCreateTableStatementFunction · 0.85
PutCreateTableStatementFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected