MCPcopy Create free account
hub / github.com/boostorg/compute / main

Function main

perf/perf_stl_set_difference.cpp:22–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22int main(int argc, char *argv[])
23{
24 perf_parse_args(argc, argv);
25
26 std::cout << "size: " << PERF_N << std::endl;
27
28 std::vector<int> v1(std::floor(PERF_N / 2.0));
29 std::vector<int> v2(std::ceil(PERF_N / 2.0));
30
31 std::generate(v1.begin(), v1.end(), rand_int);
32 std::generate(v2.begin(), v2.end(), rand_int);
33
34 std::sort(v1.begin(), v1.end());
35 std::sort(v2.begin(), v2.end());
36
37 std::vector<int> v3(PERF_N);
38 std::vector<int>::iterator v3_end;
39
40 perf_timer t;
41 for(size_t trial = 0; trial < PERF_TRIALS; trial++){
42 t.start();
43 v3_end = std::set_difference(
44 v1.begin(), v1.end(),
45 v2.begin(), v2.end(),
46 v3.begin()
47 );
48 t.stop();
49 }
50 std::cout << "time: " << t.min_time() / 1e6 << " ms" << std::endl;
51 std::cout << "size: " << std::distance(v3.begin(), v3_end) << std::endl;
52
53 return 0;
54}

Callers

nothing calls this directly

Calls 9

perf_parse_argsFunction · 0.85
generateFunction · 0.85
sortFunction · 0.85
set_differenceFunction · 0.85
startMethod · 0.80
stopMethod · 0.80
min_timeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected