MCPcopy
hub / github.com/perkeep/perkeep / BenchmarkQueryRecentPermanodes

Function BenchmarkQueryRecentPermanodes

pkg/search/query_test.go:1953–1985  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1951}
1952
1953func BenchmarkQueryRecentPermanodes(b *testing.B) {
1954 b.ReportAllocs()
1955 testQueryTypes(b, corpusTypeOnly, func(qt *queryTest) {
1956 id := qt.id
1957
1958 p1 := id.NewPlannedPermanode("1")
1959 id.SetAttribute(p1, "foo", "p1")
1960 p2 := id.NewPlannedPermanode("2")
1961 id.SetAttribute(p2, "foo", "p2")
1962 p3 := id.NewPlannedPermanode("3")
1963 id.SetAttribute(p3, "foo", "p3")
1964
1965 req := &SearchQuery{
1966 Constraint: &Constraint{
1967 Permanode: &PermanodeConstraint{},
1968 },
1969 Limit: 2,
1970 Sort: UnspecifiedSort,
1971 Describe: &DescribeRequest{},
1972 }
1973
1974 h := qt.Handler()
1975 b.ResetTimer()
1976
1977 for i := 0; i < b.N; i++ {
1978 *req.Describe = DescribeRequest{}
1979 _, err := h.Query(ctxbg, req)
1980 if err != nil {
1981 qt.t.Fatal(err)
1982 }
1983 }
1984 })
1985}
1986
1987func BenchmarkQueryPermanodes(b *testing.B) {
1988 benchmarkQueryPermanodes(b, false)

Callers

nothing calls this directly

Calls 6

testQueryTypesFunction · 0.85
NewPlannedPermanodeMethod · 0.80
SetAttributeMethod · 0.80
HandlerMethod · 0.80
FatalMethod · 0.80
QueryMethod · 0.65

Tested by

no test coverage detected