MCPcopy Create free account
hub / github.com/apache/impala / InitTestData

Function InitTestData

be/src/benchmarks/string-benchmark.cc:155–178  ·  view source on GitHub ↗

This creates more short strings than long strings.

Source from the content-addressed store, hash-verified

153
154// This creates more short strings than long strings.
155void InitTestData(TestData* data, int num_small_strings, int num_large_strings) {
156 for (int i = 0; i < num_small_strings; ++i) {
157 data->string_data.push_back("small");
158 }
159 for (int i = 0; i < num_large_strings; ++i) {
160 // We don't need this to be too large as to minimize the crc time. It just
161 // needs to be large enough to trigger then indirect string path.
162 data->string_data.push_back("large-large-large");
163 }
164
165 for (int i = 0; i < num_small_strings; ++i) {
166 AddTestString(data, data->string_data[i].c_str());
167 }
168
169 for (int i = 0; i < num_large_strings; ++i) {
170 AddTestString(data, data->string_data[i + num_large_strings].c_str());
171 }
172
173 data->random_order.resize(data->normal_strings.size());
174 for (int i = 0; i < data->random_order.size(); ++i) {
175 data->random_order[i] = i;
176 }
177 random_shuffle(data->random_order.begin(), data->random_order.end());
178}
179
180int main(int argc, char **argv) {
181 CpuInfo::Init();

Callers 1

mainFunction · 0.70

Calls 6

AddTestStringFunction · 0.85
push_backMethod · 0.80
resizeMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected