Page MenuHomePhabricator

Add benchmark for std::set.
ClosedPublic

Authored by sbenza on Oct 22 2018, 12:59 PM.

Details

Summary

Benchmarks for construct, find, insert and iterate, with sequential
and random ordered inputs.

It also improves the cartesian product benchmark header to allow for
runtime values to be specified in the product.

Diff Detail

Repository
rL LLVM

Event Timeline

sbenza created this revision.Oct 22 2018, 12:59 PM
EricWF accepted this revision.Oct 22 2018, 6:47 PM
This revision is now accepted and ready to land.Oct 22 2018, 6:47 PM
Closed by commit rL345035: Add benchmark for std::set. (authored by sbenza, committed by ). · Explain WhyOct 23 2018, 7:52 AM
This revision was automatically updated to reflect the committed changes.

Hi!

FYI, this patch fails to compile on my machine:

Required change:

void run(benchmark::State& State) const {
  std::vector<size_t> Keys(TableSize);

void run(benchmark::State& State) const {
  std::vector<uint64_t> Keys(TableSize);

I'll add to the pr I'm working on now.

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:46:69: note: in instantiation of member function '(anonymous

namespace)::Create<internal::EnumValue<(anonymous namespace)::AllAccessPattern, (anonymous namespace)::AccessPattern, 1> >::run' requested
here
                             [=](benchmark::State& S) { Bench.run(S); });
                                                              ^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:53:3: note: in instantiation of function template specialization

    'internal::makeBenchmarkFromValuesImpl<(anonymous namespace)::Create<internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 1> >, std::__1::vector<std::__1::tuple<unsigned long, unsigned long>,
    std::__1::allocator<std::__1::tuple<unsigned long, unsigned long> > >, 0, 1>' requested here
makeBenchmarkFromValuesImpl<B>(A, std::index_sequence_for<Args...>());
^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:58:3: note: in instantiation of function template specialization

    'internal::makeBenchmarkFromValues<(anonymous namespace)::Create<internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 1> >, unsigned long, unsigned long>' requested here
makeBenchmarkFromValues<B<U...> >(A);
^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:65:14: note: in instantiation of function template specialization

    'internal::makeBenchmarkImpl<Create, std::__1::vector<std::__1::tuple<unsigned long, unsigned long>,
    std::__1::allocator<std::__1::tuple<unsigned long, unsigned long> > >, internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 1> >' requested here
(internal::makeBenchmarkImpl<B>(A, std::tuple<U..., T>(), rest...), ...);
           ^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:115:13: note: in instantiation of function template specialization

    'internal::makeBenchmarkImpl<Create, std::__1::vector<std::__1::tuple<unsigned long, unsigned long>,
    std::__1::allocator<std::__1::tuple<unsigned long, unsigned long> > >, internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 0>, internal::EnumValue<(anonymous namespace)::AllAccessPattern, (anonymous namespace)::AccessPattern,
    1> >' requested here
internal::makeBenchmarkImpl<B>(V, std::tuple<>(), Tuples()...);
          ^

/space/llvm/llvm/projects/libcxx/benchmarks/ordered_set.bench.cpp:237:3: note: in instantiation of function template specialization

    'makeCartesianProductBenchmark<Create, (anonymous namespace)::AllAccessPattern, std::__1::vector<unsigned long, std::__1::allocator<unsigned
    long> >, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > >' requested here
makeCartesianProductBenchmark<Create, AllAccessPattern>(TableSize, NumTables);
^

/space/llvm/llvm/projects/libcxx/benchmarks/ordered_set.bench.cpp:37:6: note: candidate function not viable: no known conversion from

'std::vector<size_t>' (aka 'vector<unsigned long>') to 'std::vector<uint64_t> &' (aka 'vector<unsigned long long> &') for 1st argument

void sortKeysBy(std::vector<uint64_t>& Keys, AccessPattern AP) {

^

/space/llvm/llvm/projects/libcxx/benchmarks/ordered_set.bench.cpp:88:5: error: no matching function for call to 'sortKeysBy'

sortKeysBy(Keys, Access());
^~~~~~~~~~

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:46:69: note: in instantiation of member function '(anonymous

namespace)::Create<internal::EnumValue<(anonymous namespace)::AllAccessPattern, (anonymous namespace)::AccessPattern, 0> >::run' requested
here
                             [=](benchmark::State& S) { Bench.run(S); });
                                                              ^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:53:3: note: in instantiation of function template specialization

    'internal::makeBenchmarkFromValuesImpl<(anonymous namespace)::Create<internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 0> >, std::__1::vector<std::__1::tuple<unsigned long, unsigned long>,
    std::__1::allocator<std::__1::tuple<unsigned long, unsigned long> > >, 0, 1>' requested here
makeBenchmarkFromValuesImpl<B>(A, std::index_sequence_for<Args...>());
^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:58:3: note: in instantiation of function template specialization

    'internal::makeBenchmarkFromValues<(anonymous namespace)::Create<internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 0> >, unsigned long, unsigned long>' requested here
makeBenchmarkFromValues<B<U...> >(A);
^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:65:14: note: in instantiation of function template specialization

    'internal::makeBenchmarkImpl<Create, std::__1::vector<std::__1::tuple<unsigned long, unsigned long>,
    std::__1::allocator<std::__1::tuple<unsigned long, unsigned long> > >, internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 0> >' requested here
(internal::makeBenchmarkImpl<B>(A, std::tuple<U..., T>(), rest...), ...);
           ^

/space/llvm/llvm/projects/libcxx/benchmarks/CartesianBenchmarks.hpp:115:13: note: in instantiation of function template specialization

    'internal::makeBenchmarkImpl<Create, std::__1::vector<std::__1::tuple<unsigned long, unsigned long>,
    std::__1::allocator<std::__1::tuple<unsigned long, unsigned long> > >, internal::EnumValue<(anonymous namespace)::AllAccessPattern,
    (anonymous namespace)::AccessPattern, 0>, internal::EnumValue<(anonymous namespace)::AllAccessPattern, (anonymous namespace)::AccessPattern,
    1> >' requested here
internal::makeBenchmarkImpl<B>(V, std::tuple<>(), Tuples()...);
          ^

/space/llvm/llvm/projects/libcxx/benchmarks/ordered_set.bench.cpp:237:3: note: in instantiation of function template specialization

    'makeCartesianProductBenchmark<Create, (anonymous namespace)::AllAccessPattern, std::__1::vector<unsigned long, std::__1::allocator<unsigned
    long> >, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > >' requested here
makeCartesianProductBenchmark<Create, AllAccessPattern>(TableSize, NumTables);
^

/space/llvm/llvm/projects/libcxx/benchmarks/ordered_set.bench.cpp:37:6: note: candidate function not viable: no known conversion from

'std::vector<size_t>' (aka 'vector<unsigned long>') to 'std::vector<uint64_t> &' (aka 'vector<unsigned long long> &') for 1st argument

void sortKeysBy(std::vector<uint64_t>& Keys, AccessPattern AP) {

^

2 warnings and 2 errors generated.
make[3]: * [projects/libcxx/benchmarks/CMakeFiles/ordered_set_libcxx.dir/ordered_set.bench.cpp.o] Error 1
make[2]:
* [projects/libcxx/benchmarks/CMakeFiles/ordered_set_libcxx.dir/all] Error 2
make[1]: * [projects/libcxx/benchmarks/CMakeFiles/cxx-benchmarks.dir/rule] Error 2
make:
* [cxx-benchmarks] Error 2

Sorry for the break.
I submitted the fix.