susumu.yata
null+****@clear*****
Mon Jul 27 11:17:47 JST 2015
susumu.yata 2015-07-27 11:17:47 +0900 (Mon, 27 Jul 2015) New Revision: 45719ba32e7524508732f6d71963444b05a11bb0 https://github.com/groonga/grngo/commit/45719ba32e7524508732f6d71963444b05a11bb0 Message: Enable benchmarks. Modified files: grngo_test.go Modified: grngo_test.go (+146 -146) =================================================================== --- grngo_test.go 2015-07-27 11:17:28 +0900 (6140676) +++ grngo_test.go 2015-07-27 11:17:47 +0900 (c3496af) @@ -1512,159 +1512,159 @@ func BenchmarkColumnSetValueForWGS84GeoPointVector(b *testing.B) { benchmarkColumnSetValue(b, "[]WGS84GeoPoint") } -//func benchmarkColumnGetValue(b *testing.B, valueType string) { -// dirPath, _, db, table, column := -// createTempColumn(b, "Table", nil, "Value", valueType, nil) -// defer removeTempDB(b, dirPath, db) -// ids := make([]uint32, numTestRows) -// for i, _ := range ids { -// _, id, err := table.InsertRow(nil) -// if err != nil { -// b.Fatalf("Table.InsertRow() failed: %s", err) -// } -// if err := column.SetValue(id, generateRandomValue(valueType)); err != nil { -// b.Fatalf("Column.SetValue() failed: %s", err) -// } -// ids[i] = id -// } - -// b.ResetTimer() -// for i := 0; i < b.N; i++ { -// for _, id := range ids { -// if _, err := column.GetValue(id); err != nil { -// b.Fatalf("Column.GetValue() failed: %s", err) -// } -// } -// } -//} - -//func BenchmarkColumnGetValueForBool(b *testing.B) { -// benchmarkColumnGetValue(b, "Bool") -//} - -//func BenchmarkColumnGetValueForInt8(b *testing.B) { -// benchmarkColumnGetValue(b, "Int8") -//} - -//func BenchmarkColumnGetValueForInt16(b *testing.B) { -// benchmarkColumnGetValue(b, "Int16") -//} - -//func BenchmarkColumnGetValueForInt32(b *testing.B) { -// benchmarkColumnGetValue(b, "Int32") -//} - -//func BenchmarkColumnGetValueForInt64(b *testing.B) { -// benchmarkColumnGetValue(b, "Int64") -//} - -//func BenchmarkColumnGetValueForUInt8(b *testing.B) { -// benchmarkColumnGetValue(b, "UInt8") -//} - -//func BenchmarkColumnGetValueForUInt16(b *testing.B) { -// benchmarkColumnGetValue(b, "UInt16") -//} - -//func BenchmarkColumnGetValueForUInt32(b *testing.B) { -// benchmarkColumnGetValue(b, "UInt32") -//} - -//func BenchmarkColumnGetValueForUInt64(b *testing.B) { -// benchmarkColumnGetValue(b, "UInt64") -//} - -//func BenchmarkColumnGetValueForFloat(b *testing.B) { -// benchmarkColumnGetValue(b, "Float") -//} - -//func BenchmarkColumnGetValueForTime(b *testing.B) { -// benchmarkColumnGetValue(b, "Time") -//} - -//func BenchmarkColumnGetValueForShortText(b *testing.B) { -// benchmarkColumnGetValue(b, "ShortText") -//} - -//func BenchmarkColumnGetValueForText(b *testing.B) { -// benchmarkColumnGetValue(b, "Text") -//} - -//func BenchmarkColumnGetValueForLongText(b *testing.B) { -// benchmarkColumnGetValue(b, "LongText") -//} - -//func BenchmarkColumnGetValueForTokyoGeoPoint(b *testing.B) { -// benchmarkColumnGetValue(b, "TokyoGeoPoint") -//} - -//func BenchmarkColumnGetValueForWGS84GeoPoint(b *testing.B) { -// benchmarkColumnGetValue(b, "WGS84GeoPoint") -//} - -//func BenchmarkColumnGetValueForBoolVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Bool") -//} - -//func BenchmarkColumnGetValueForInt8Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Int8") -//} - -//func BenchmarkColumnGetValueForInt16Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Int16") -//} - -//func BenchmarkColumnGetValueForInt32Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Int32") -//} - -//func BenchmarkColumnGetValueForInt64Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Int64") -//} - -//func BenchmarkColumnGetValueForUInt8Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]UInt8") -//} - -//func BenchmarkColumnGetValueForUInt16Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]UInt16") -//} - -//func BenchmarkColumnGetValueForUInt32Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]UInt32") -//} - -//func BenchmarkColumnGetValueForUInt64Vector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]UInt64") -//} +func benchmarkColumnGetValue(b *testing.B, valueType string) { + dirPath, _, db, table, column := + createTempColumn(b, "Table", nil, "Value", valueType, nil) + defer removeTempDB(b, dirPath, db) + ids := make([]uint32, numTestRows) + for i, _ := range ids { + _, id, err := table.InsertRow(nil) + if err != nil { + b.Fatalf("Table.InsertRow() failed: %s", err) + } + if err := column.SetValue(id, generateRandomValue(valueType)); err != nil { + b.Fatalf("Column.SetValue() failed: %s", err) + } + ids[i] = id + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + for _, id := range ids { + if _, err := column.GetValue(id); err != nil { + b.Fatalf("Column.GetValue() failed: %s", err) + } + } + } +} + +func BenchmarkColumnGetValueForBool(b *testing.B) { + benchmarkColumnGetValue(b, "Bool") +} + +func BenchmarkColumnGetValueForInt8(b *testing.B) { + benchmarkColumnGetValue(b, "Int8") +} + +func BenchmarkColumnGetValueForInt16(b *testing.B) { + benchmarkColumnGetValue(b, "Int16") +} + +func BenchmarkColumnGetValueForInt32(b *testing.B) { + benchmarkColumnGetValue(b, "Int32") +} + +func BenchmarkColumnGetValueForInt64(b *testing.B) { + benchmarkColumnGetValue(b, "Int64") +} + +func BenchmarkColumnGetValueForUInt8(b *testing.B) { + benchmarkColumnGetValue(b, "UInt8") +} + +func BenchmarkColumnGetValueForUInt16(b *testing.B) { + benchmarkColumnGetValue(b, "UInt16") +} + +func BenchmarkColumnGetValueForUInt32(b *testing.B) { + benchmarkColumnGetValue(b, "UInt32") +} + +func BenchmarkColumnGetValueForUInt64(b *testing.B) { + benchmarkColumnGetValue(b, "UInt64") +} -//func BenchmarkColumnGetValueForFloatVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Float") -//} +func BenchmarkColumnGetValueForFloat(b *testing.B) { + benchmarkColumnGetValue(b, "Float") +} + +func BenchmarkColumnGetValueForTime(b *testing.B) { + benchmarkColumnGetValue(b, "Time") +} + +func BenchmarkColumnGetValueForShortText(b *testing.B) { + benchmarkColumnGetValue(b, "ShortText") +} + +func BenchmarkColumnGetValueForText(b *testing.B) { + benchmarkColumnGetValue(b, "Text") +} + +func BenchmarkColumnGetValueForLongText(b *testing.B) { + benchmarkColumnGetValue(b, "LongText") +} + +func BenchmarkColumnGetValueForTokyoGeoPoint(b *testing.B) { + benchmarkColumnGetValue(b, "TokyoGeoPoint") +} + +func BenchmarkColumnGetValueForWGS84GeoPoint(b *testing.B) { + benchmarkColumnGetValue(b, "WGS84GeoPoint") +} + +func BenchmarkColumnGetValueForBoolVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Bool") +} -//func BenchmarkColumnGetValueForTimeVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Time") -//} +func BenchmarkColumnGetValueForInt8Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Int8") +} -//func BenchmarkColumnGetValueForShortTextVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]ShortText") -//} +func BenchmarkColumnGetValueForInt16Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Int16") +} -//func BenchmarkColumnGetValueForTextVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]Text") -//} +func BenchmarkColumnGetValueForInt32Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Int32") +} -//func BenchmarkColumnGetValueForLongTextVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]LongText") -//} +func BenchmarkColumnGetValueForInt64Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Int64") +} -//func BenchmarkColumnGetValueForTokyoGeoPointVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]TokyoGeoPoint") -//} +func BenchmarkColumnGetValueForUInt8Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]UInt8") +} -//func BenchmarkColumnGetValueForWGS84GeoPointVector(b *testing.B) { -// benchmarkColumnGetValue(b, "[]WGS84GeoPoint") -//} +func BenchmarkColumnGetValueForUInt16Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]UInt16") +} + +func BenchmarkColumnGetValueForUInt32Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]UInt32") +} + +func BenchmarkColumnGetValueForUInt64Vector(b *testing.B) { + benchmarkColumnGetValue(b, "[]UInt64") +} + +func BenchmarkColumnGetValueForFloatVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Float") +} + +func BenchmarkColumnGetValueForTimeVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Time") +} + +func BenchmarkColumnGetValueForShortTextVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]ShortText") +} + +func BenchmarkColumnGetValueForTextVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]Text") +} + +func BenchmarkColumnGetValueForLongTextVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]LongText") +} + +func BenchmarkColumnGetValueForTokyoGeoPointVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]TokyoGeoPoint") +} + +func BenchmarkColumnGetValueForWGS84GeoPointVector(b *testing.B) { + benchmarkColumnGetValue(b, "[]WGS84GeoPoint") +} func benchmarkDBSelect(b *testing.B, valueType string) { dirPath, _, db, table, column := -------------- next part -------------- HTML����������������������������...Download