(b *testing.B, describe bool)
| 1993 | } |
| 1994 | |
| 1995 | func benchmarkQueryPermanodes(b *testing.B, describe bool) { |
| 1996 | b.ReportAllocs() |
| 1997 | testQueryTypes(b, corpusTypeOnly, func(qt *queryTest) { |
| 1998 | id := qt.id |
| 1999 | |
| 2000 | for i := 0; i < 1000; i++ { |
| 2001 | pn := id.NewPlannedPermanode(fmt.Sprint(i)) |
| 2002 | id.SetAttribute(pn, "foo", fmt.Sprint(i)) |
| 2003 | } |
| 2004 | |
| 2005 | req := &SearchQuery{ |
| 2006 | Constraint: &Constraint{ |
| 2007 | Permanode: &PermanodeConstraint{}, |
| 2008 | }, |
| 2009 | } |
| 2010 | if describe { |
| 2011 | req.Describe = &DescribeRequest{} |
| 2012 | } |
| 2013 | |
| 2014 | h := qt.Handler() |
| 2015 | b.ResetTimer() |
| 2016 | |
| 2017 | for i := 0; i < b.N; i++ { |
| 2018 | if describe { |
| 2019 | *req.Describe = DescribeRequest{} |
| 2020 | } |
| 2021 | _, err := h.Query(ctxbg, req) |
| 2022 | if err != nil { |
| 2023 | qt.t.Fatal(err) |
| 2024 | } |
| 2025 | } |
| 2026 | }) |
| 2027 | } |
| 2028 | |
| 2029 | func BenchmarkQueryPermanodeLocation(b *testing.B) { |
| 2030 | b.ReportAllocs() |
no test coverage detected