use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileGetInComplexStructureMicroBenchmark method benchmark.
public void benchmark(int count, boolean useVariant) {
QueryProfile main = createProfile(useVariant);
Query query = new Query(QueryTestCase.httpEncode("?query=test&x=1&y=2"), main.compile(null));
// warm-up
getValues(100000, query);
System.out.print(this + ": ");
long startTime = System.currentTimeMillis();
getValues(count, query);
long endTime = System.currentTimeMillis();
long totalTime = (endTime - startTime);
// *2 because we do 2 gets
System.out.println("Done in " + totalTime + " ms (" + ((float) totalTime * 1000 / (count * 2) + " microsecond per get)"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testSettingNonLeaf4a.
public void testSettingNonLeaf4a() {
QueryProfile p = new QueryProfile("test");
p.setDimensions(new String[] { "x" });
p.set("a.b", "a.b-value", new String[] { "x1" }, null);
p.set("a", "a-value", (QueryProfileRegistry) null);
QueryProfileProperties cp = new QueryProfileProperties(p.compile(null));
assertEquals("a-value", cp.get("a"));
assertNull(cp.get("a.b"));
assertEquals("a-value", cp.get("a", new String[] { "x1" }));
assertEquals("a.b-value", cp.get("a.b", QueryProfileVariantsTestCase.toMap(p, new String[] { "x1" })));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testInheritance.
public void testInheritance() {
QueryProfile barn = new QueryProfile("barn");
QueryProfile mor = new QueryProfile("mor");
QueryProfile far = new QueryProfile("far");
QueryProfile mormor = new QueryProfile("mormor");
QueryProfile morfar = new QueryProfile("morfar");
QueryProfile farfar = new QueryProfile("farfar");
barn.addInherited(mor);
barn.addInherited(far);
mor.addInherited(mormor);
mor.addInherited(morfar);
far.addInherited(farfar);
morfar.set("a", "morfar-a", (QueryProfileRegistry) null);
mormor.set("a", "mormor-a", (QueryProfileRegistry) null);
farfar.set("a", "farfar-a", (QueryProfileRegistry) null);
mor.set("a", "mor-a", (QueryProfileRegistry) null);
far.set("a", "far-a", (QueryProfileRegistry) null);
barn.set("a", "barn-a", (QueryProfileRegistry) null);
mormor.set("b", "mormor-b", (QueryProfileRegistry) null);
far.set("b", "far-b", (QueryProfileRegistry) null);
mor.set("c", "mor-c", (QueryProfileRegistry) null);
far.set("c", "far-c", (QueryProfileRegistry) null);
mor.set("d.a", "mor-d.a", (QueryProfileRegistry) null);
barn.set("d.b", "barn-d.b", (QueryProfileRegistry) null);
QueryProfile annetBarn = new QueryProfile("annetBarn");
annetBarn.set("venn", barn, (QueryProfileRegistry) null);
CompiledQueryProfile cbarn = barn.compile(null);
CompiledQueryProfile cannetBarn = annetBarn.compile(null);
assertEquals("barn-a", cbarn.get("a"));
assertEquals("mormor-b", cbarn.get("b"));
assertEquals("mor-c", cbarn.get("c"));
assertEquals("barn-a", cannetBarn.get("venn.a"));
assertEquals("mormor-b", cannetBarn.get("venn.b"));
assertEquals("mor-c", cannetBarn.get("venn.c"));
assertEquals("barn-d.b", cbarn.get("d.b"));
assertEquals("mor-d.a", cbarn.get("d.a"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testListProperties.
public void testListProperties() {
QueryProfile barn = new QueryProfile("barn");
QueryProfile mor = new QueryProfile("mor");
QueryProfile far = new QueryProfile("far");
QueryProfile mormor = new QueryProfile("mormor");
QueryProfile morfar = new QueryProfile("morfar");
QueryProfile farfar = new QueryProfile("farfar");
barn.addInherited(mor);
barn.addInherited(far);
mor.addInherited(mormor);
mor.addInherited(morfar);
far.addInherited(farfar);
morfar.set("a", "morfar-a", (QueryProfileRegistry) null);
morfar.set("model.b", "morfar-model.b", (QueryProfileRegistry) null);
mormor.set("a", "mormor-a", (QueryProfileRegistry) null);
mormor.set("model.b", "mormor-model.b", (QueryProfileRegistry) null);
farfar.set("a", "farfar-a", (QueryProfileRegistry) null);
mor.set("a", "mor-a", (QueryProfileRegistry) null);
far.set("a", "far-a", (QueryProfileRegistry) null);
barn.set("a", "barn-a", (QueryProfileRegistry) null);
mormor.set("b", "mormor-b", (QueryProfileRegistry) null);
far.set("b", "far-b", (QueryProfileRegistry) null);
mor.set("c", "mor-c", (QueryProfileRegistry) null);
far.set("c", "far-c", (QueryProfileRegistry) null);
CompiledQueryProfile cbarn = barn.compile(null);
QueryProfileProperties properties = new QueryProfileProperties(cbarn);
assertEquals("barn-a", cbarn.get("a"));
assertEquals("mormor-b", cbarn.get("b"));
Map<String, Object> rootMap = properties.listProperties();
assertEquals("barn-a", rootMap.get("a"));
assertEquals("mormor-b", rootMap.get("b"));
assertEquals("mor-c", rootMap.get("c"));
Map<String, Object> modelMap = properties.listProperties("model");
assertEquals("mormor-model.b", modelMap.get("b"));
QueryProfile annetBarn = new QueryProfile("annetBarn");
annetBarn.set("venn", barn, (QueryProfileRegistry) null);
CompiledQueryProfile cannetBarn = annetBarn.compile(null);
Map<String, Object> annetBarnMap = new QueryProfileProperties(cannetBarn).listProperties();
assertEquals("barn-a", annetBarnMap.get("venn.a"));
assertEquals("mormor-b", annetBarnMap.get("venn.b"));
assertEquals("mor-c", annetBarnMap.get("venn.c"));
assertEquals("mormor-model.b", annetBarnMap.get("venn.model.b"));
}
use of com.yahoo.search.query.profile.QueryProfile in project vespa by vespa-engine.
the class QueryProfileTestCase method testSettingNonLeaf2.
public void testSettingNonLeaf2() {
QueryProfile p = new QueryProfile("test");
p.set("a.b", "a.b-value", (QueryProfileRegistry) null);
p.set("a", "a-value", (QueryProfileRegistry) null);
QueryProfileProperties cp = new QueryProfileProperties(p.compile(null));
assertEquals("a-value", cp.get("a"));
assertEquals("a.b-value", cp.get("a.b"));
}
Aggregations