MCPcopy Create free account
hub / github.com/apache/solr / main

Method main

solr/core/src/test/org/apache/solr/search/DocSetPerf.java:61–152  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

59 }
60
61 public static void main(String[] args) {
62 String bsSize = args[0];
63 boolean randSize = false;
64
65 if (bsSize.endsWith("-")) {
66 bsSize = bsSize.substring(0, bsSize.length() - 1);
67 randSize = true;
68 }
69
70 int bitSetSize = Integer.parseInt(bsSize);
71 int numSets = Integer.parseInt(args[1]);
72 int numBitsSet = Integer.parseInt(args[2]);
73 String test = args[3].intern();
74 int iter = Integer.parseInt(args[4]);
75
76 long ret = 0;
77
78 FixedBitSet[] sets = new FixedBitSet[numSets];
79 DocSet[] bset = new DocSet[numSets];
80
81 for (int i = 0; i < numSets; i++) {
82 generate(randSize ? rand.nextInt(bitSetSize) : bitSetSize, numBitsSet);
83 sets[i] = bs;
84 bset[i] = bds;
85 }
86
87 final RTimer timer = new RTimer();
88
89 if ("test".equals(test)) {
90 for (int it = 0; it < iter; it++) {
91 generate(randSize ? rand.nextInt(bitSetSize) : bitSetSize, numBitsSet);
92 FixedBitSet bs1 = bs;
93 BitDocSet bds1 = bds;
94 generate(randSize ? rand.nextInt(bitSetSize) : bitSetSize, numBitsSet);
95
96 FixedBitSet res = bs1.clone();
97 res.and(bs);
98 int icount = res.cardinality();
99
100 test(bds1.intersection(bds).size() == icount);
101 test(bds1.intersectionSize(bds) == icount);
102
103 ret += icount;
104 }
105 }
106
107 String type = null;
108 String oper = null;
109
110 if (test.endsWith("B")) {
111 type = "B";
112 }
113 if (test.endsWith("M")) {
114 type = "M";
115 }
116 if (test.startsWith("intersect")) oper = "intersect";
117 if (test.startsWith("intersectSize")) oper = "intersectSize";
118 if (test.startsWith("intersectAndSize")) oper = "intersectSize";

Callers

nothing calls this directly

Calls 15

generateMethod · 0.95
testMethod · 0.95
intersectionMethod · 0.95
intersectionSizeMethod · 0.95
intersectionMethod · 0.95
intersectionSizeMethod · 0.95
sizeMethod · 0.95
getTimeMethod · 0.95
nextIntMethod · 0.80
lengthMethod · 0.65
cloneMethod · 0.65
sizeMethod · 0.65

Tested by

no test coverage detected