#include <folly/AtomicUnorderedMap.h>
+#include <memory>
#include <thread>
#include <unordered_map>
using namespace folly;
using namespace folly::test;
-template<class T>
+template <class T>
struct non_atomic {
T value;
bool is_lock_free() const {return true;}
};
-template <typename Key,
- typename Value,
- typename IndexType,
- template <typename> class Atom = std::atomic,
- typename Allocator = std::allocator<char>>
+template <
+ typename Key,
+ typename Value,
+ typename IndexType,
+ template <typename> class Atom = std::atomic,
+ typename Allocator = std::allocator<char>>
using UIM =
AtomicUnorderedInsertMap<Key,
Value,
namespace {
template <typename T>
struct AtomicUnorderedInsertMapTest : public ::testing::Test {};
-}
+} // namespace
// uint16_t doesn't make sense for most platforms, but we might as well
// test it
size_t capacity = 100000;
BENCHMARK_SUSPEND {
- ptr.reset(new AtomicUnorderedInsertMap<int,size_t>(capacity));
+ ptr = std::make_unique<AtomicUnorderedInsertMap<int, size_t>>(capacity);
for (size_t i = 0; i < capacity; ++i) {
auto k = 3 * ((5641 * i) % capacity);
ptr->emplace(k, k + 1);
std::vector<std::thread> threads;
BENCHMARK_SUSPEND {
- ptr.reset(new Map(capacity));
+ ptr = std::make_unique<Map>(capacity);
while (threads.size() < numThreads) {
threads.emplace_back([&](){
while (!go) {