deque.bench.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #include <deque>
  10. #include "benchmark/benchmark.h"
  11. #include "ContainerBenchmarks.h"
  12. #include "GenerateInput.h"
  13. using namespace ContainerBenchmarks;
  14. constexpr std::size_t TestNumInputs = 1024;
  15. BENCHMARK_CAPTURE(BM_ConstructSize,
  16. deque_byte,
  17. std::deque<unsigned char>{})->Arg(5140480);
  18. BENCHMARK_CAPTURE(BM_ConstructSizeValue,
  19. deque_byte,
  20. std::deque<unsigned char>{}, 0)->Arg(5140480);
  21. BENCHMARK_CAPTURE(BM_ConstructIterIter,
  22. deque_char,
  23. std::deque<char>{},
  24. getRandomIntegerInputs<char>)->Arg(TestNumInputs);
  25. BENCHMARK_CAPTURE(BM_ConstructIterIter,
  26. deque_size_t,
  27. std::deque<size_t>{},
  28. getRandomIntegerInputs<size_t>)->Arg(TestNumInputs);
  29. BENCHMARK_CAPTURE(BM_ConstructIterIter,
  30. deque_string,
  31. std::deque<std::string>{},
  32. getRandomStringInputs)->Arg(TestNumInputs);
  33. BENCHMARK_MAIN();