diff options
author | Vincent Ambo <mail@tazj.in> | 2020-12-23T12·36+0100 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2020-12-23T12·44+0000 |
commit | 73e9265f954528b6b2eccf98572e77126539a8df (patch) | |
tree | 48a1e093761e86c5e605d074e8c4d5f1bb64f1b1 /third_party/immer/benchmark/set | |
parent | f7ea650142eb796eb3f2827c805cc0bc563e2183 (diff) |
chore(3p/immer): Remove vendored copy of immer r/2029
We ended up dropping the use of this library again. Change-Id: I2c44cd22a6128d23f87a582402bf5fb84991d608 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2292 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'third_party/immer/benchmark/set')
22 files changed, 0 insertions, 712 deletions
diff --git a/third_party/immer/benchmark/set/access.hpp b/third_party/immer/benchmark/set/access.hpp deleted file mode 100644 index 8605c0ff453c..000000000000 --- a/third_party/immer/benchmark/set/access.hpp +++ /dev/null @@ -1,175 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#pragma once - -#include "benchmark/config.hpp" - -#include <immer/set.hpp> -#include <hash_trie.hpp> // Phil Nash -#include <boost/container/flat_set.hpp> -#include <set> -#include <unordered_set> - -namespace { - -template <typename T=unsigned> -auto make_generator_ranged(std::size_t runs) -{ - assert(runs > 0); - auto engine = std::default_random_engine{13}; - auto dist = std::uniform_int_distribution<T>{0, (T)runs-1}; - auto r = std::vector<T>(runs); - std::generate_n(r.begin(), runs, std::bind(dist, engine)); - return r; -} - -template <typename Generator, typename Set> -auto benchmark_access_std() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n); - auto g2 = make_generator_ranged(n); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v.insert(g1[i]); - - measure(meter, [&] { - auto c = 0u; - for (auto i = 0u; i < n; ++i) - c += v.count(g1[g2[i]]); - volatile auto r = c; - return r; - }); - }; -} - -template <typename Generator, typename Set> -auto benchmark_access_hamt() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n); - auto g2 = make_generator_ranged(n); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v.insert(g1[i]); - - measure(meter, [&] { - auto c = 0u; - for (auto i = 0u; i < n; ++i) { - auto& x = g1[g2[i]]; - auto leaf = v.find(x).leaf(); - c += !!(leaf && leaf->find(x)); - } - volatile auto r = c; - return r; - }); - }; -} - - -template <typename Generator, typename Set> -auto benchmark_access() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n); - auto g2 = make_generator_ranged(n); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v = v.insert(g1[i]); - - measure(meter, [&] { - auto c = 0u; - for (auto i = 0u; i < n; ++i) - c += v.count(g1[g2[i]]); - volatile auto r = c; - return r; - }); - }; -} - -template <typename Generator, typename Set> -auto benchmark_bad_access_std() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n*2); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v.insert(g1[i]); - - measure(meter, [&] { - auto c = 0u; - for (auto i = 0u; i < n; ++i) - c += v.count(g1[n+i]); - volatile auto r = c; - return r; - }); - }; -} - -template <typename Generator, typename Set> -auto benchmark_bad_access_hamt() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n*2); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v.insert(g1[i]); - - measure(meter, [&] { - auto c = 0u; - for (auto i = 0u; i < n; ++i) { - auto& x = g1[n+i]; - auto leaf = v.find(x).leaf(); - c += !!(leaf && leaf->find(x)); - } - volatile auto r = c; - return r; - }); - }; -} - - -template <typename Generator, typename Set> -auto benchmark_bad_access() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n*2); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v = v.insert(g1[i]); - - measure(meter, [&] { - auto c = 0u; - for (auto i = 0u; i < n; ++i) - c += v.count(g1[n+i]); - volatile auto r = c; - return r; - }); - }; -} - -} // namespace diff --git a/third_party/immer/benchmark/set/access.ipp b/third_party/immer/benchmark/set/access.ipp deleted file mode 100644 index f026d9cfa736..000000000000 --- a/third_party/immer/benchmark/set/access.ipp +++ /dev/null @@ -1,30 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "access.hpp" - -#ifndef GENERATOR_T -#error "you must define a GENERATOR_T" -#endif - -using generator__ = GENERATOR_T; -using t__ = typename decltype(generator__{}(0))::value_type; - -NONIUS_BENCHMARK("std::set", benchmark_access_std<generator__, std::set<t__>>()) -NONIUS_BENCHMARK("std::unordered_set", benchmark_access_std<generator__, std::unordered_set<t__>>()) -NONIUS_BENCHMARK("boost::flat_set", benchmark_access_std<generator__, boost::container::flat_set<t__>>()) -NONIUS_BENCHMARK("hamt::hash_trie", benchmark_access_hamt<generator__, hamt::hash_trie<t__>>()) -NONIUS_BENCHMARK("immer::set/5B", benchmark_access<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>()) -NONIUS_BENCHMARK("immer::set/4B", benchmark_access<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>()) - -NONIUS_BENCHMARK("bad/std::set", benchmark_bad_access_std<generator__, std::set<t__>>()) -NONIUS_BENCHMARK("bad/std::unordered_set", benchmark_bad_access_std<generator__, std::unordered_set<t__>>()) -NONIUS_BENCHMARK("bad/boost::flat_set", benchmark_bad_access_std<generator__, boost::container::flat_set<t__>>()) -NONIUS_BENCHMARK("bad/hamt::hash_trie", benchmark_bad_access_hamt<generator__, hamt::hash_trie<t__>>()) -NONIUS_BENCHMARK("bad/immer::set/5B", benchmark_bad_access<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>()) -NONIUS_BENCHMARK("bad/immer::set/4B", benchmark_bad_access<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>()) diff --git a/third_party/immer/benchmark/set/insert.hpp b/third_party/immer/benchmark/set/insert.hpp deleted file mode 100644 index be679b4de342..000000000000 --- a/third_party/immer/benchmark/set/insert.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#pragma once - -#include "benchmark/config.hpp" - -#include <immer/set.hpp> -#include <hash_trie.hpp> // Phil Nash -#include <boost/container/flat_set.hpp> -#include <set> -#include <unordered_set> - -namespace { - -template <typename Generator, typename Set> -auto benchmark_insert_mut_std() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g = Generator{}(n); - - measure(meter, [&] { - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v.insert(g[i]); - return v; - }); - }; -} - -template <typename Generator, typename Set> -auto benchmark_insert() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g = Generator{}(n); - - measure(meter, [&] { - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v = v.insert(g[i]); - return v; - }); - }; -} - -} // namespace diff --git a/third_party/immer/benchmark/set/insert.ipp b/third_party/immer/benchmark/set/insert.ipp deleted file mode 100644 index 6717ccd57ea7..000000000000 --- a/third_party/immer/benchmark/set/insert.ipp +++ /dev/null @@ -1,28 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "insert.hpp" - -#ifndef GENERATOR_T -#error "you must define a GENERATOR_T" -#endif - -using generator__ = GENERATOR_T; -using t__ = typename decltype(generator__{}(0))::value_type; - -NONIUS_BENCHMARK("std::set", benchmark_insert_mut_std<generator__, std::set<t__>>()) -NONIUS_BENCHMARK("std::unordered_set", benchmark_insert_mut_std<generator__, std::unordered_set<t__>>()) -NONIUS_BENCHMARK("boost::flat_set", benchmark_insert_mut_std<generator__, boost::container::flat_set<t__>>()) -NONIUS_BENCHMARK("hamt::hash_trie", benchmark_insert_mut_std<generator__, hamt::hash_trie<t__>>()) - -NONIUS_BENCHMARK("immer::set/5B", benchmark_insert<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>()) -NONIUS_BENCHMARK("immer::set/4B", benchmark_insert<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>()) -#ifndef DISABLE_GC_BENCHMARKS -NONIUS_BENCHMARK("immer::set/GC", benchmark_insert<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,gc_memory,5>>()) -#endif -NONIUS_BENCHMARK("immer::set/UN", benchmark_insert<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>()) diff --git a/third_party/immer/benchmark/set/iter.hpp b/third_party/immer/benchmark/set/iter.hpp deleted file mode 100644 index 91dd48644367..000000000000 --- a/third_party/immer/benchmark/set/iter.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#pragma once - -#include "benchmark/config.hpp" - -#include <immer/set.hpp> -#include <immer/box.hpp> -#include <immer/algorithm.hpp> -#include <hash_trie.hpp> // Phil Nash -#include <boost/container/flat_set.hpp> -#include <set> -#include <unordered_set> -#include <numeric> - -namespace { - -template <typename T> -struct iter_step -{ - unsigned operator() (unsigned x, const T& y) const - { - return x + y; - } -}; - -template <> -struct iter_step<std::string> -{ - unsigned operator() (unsigned x, const std::string& y) const - { - return x + (unsigned) y.size(); - } -}; - -template <> -struct iter_step<immer::box<std::string>> -{ - unsigned operator() (unsigned x, const immer::box<std::string>& y) const - { - return x + (unsigned) y->size(); - } -}; - -template <typename Generator, typename Set> -auto benchmark_access_std_iter() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v.insert(g1[i]); - - using step_t = iter_step<typename decltype(g1)::value_type>; - measure(meter, [&] { - volatile auto c = std::accumulate(v.begin(), v.end(), 0u, step_t{}); - return c; - }); - }; -} - -template <typename Generator, typename Set> -auto benchmark_access_reduce() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v = v.insert(g1[i]); - - using step_t = iter_step<typename decltype(g1)::value_type>; - measure(meter, [&] { - volatile auto c = immer::accumulate(v, 0u, step_t{}); - return c; - }); - }; -} - -template <typename Generator, typename Set> -auto benchmark_access_iter() -{ - return [] (nonius::chronometer meter) - { - auto n = meter.param<N>(); - auto g1 = Generator{}(n); - - auto v = Set{}; - for (auto i = 0u; i < n; ++i) - v = v.insert(g1[i]); - - using step_t = iter_step<typename decltype(g1)::value_type>; - measure(meter, [&] { - volatile auto c = std::accumulate(v.begin(), v.end(), 0u, step_t{}); - return c; - }); - }; -} - -} // namespace diff --git a/third_party/immer/benchmark/set/iter.ipp b/third_party/immer/benchmark/set/iter.ipp deleted file mode 100644 index f8c3cb9695cd..000000000000 --- a/third_party/immer/benchmark/set/iter.ipp +++ /dev/null @@ -1,25 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "iter.hpp" - -#ifndef GENERATOR_T -#error "you must define a GENERATOR_T" -#endif - -using generator__ = GENERATOR_T; -using t__ = typename decltype(generator__{}(0))::value_type; - -NONIUS_BENCHMARK("iter/std::set", benchmark_access_std_iter<generator__, std::set<t__>>()) -NONIUS_BENCHMARK("iter/std::unordered_set", benchmark_access_std_iter<generator__, std::unordered_set<t__>>()) -NONIUS_BENCHMARK("iter/boost::flat_set", benchmark_access_std_iter<generator__, boost::container::flat_set<t__>>()) -NONIUS_BENCHMARK("iter/hamt::hash_trie", benchmark_access_std_iter<generator__, hamt::hash_trie<t__>>()) -NONIUS_BENCHMARK("iter/immer::set/5B", benchmark_access_iter<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>()) -NONIUS_BENCHMARK("iter/immer::set/4B", benchmark_access_iter<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>()) -NONIUS_BENCHMARK("reduce/immer::set/5B", benchmark_access_reduce<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>()) -NONIUS_BENCHMARK("reduce/immer::set/4B", benchmark_access_reduce<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>()) diff --git a/third_party/immer/benchmark/set/string-box/access.cpp b/third_party/immer/benchmark/set/string-box/access.cpp deleted file mode 100644 index c3deffbb0636..000000000000 --- a/third_party/immer/benchmark/set/string-box/access.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../access.ipp" diff --git a/third_party/immer/benchmark/set/string-box/generator.ipp b/third_party/immer/benchmark/set/string-box/generator.ipp deleted file mode 100644 index 9adc82e0bdc0..000000000000 --- a/third_party/immer/benchmark/set/string-box/generator.ipp +++ /dev/null @@ -1,46 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/box.hpp> - -#include <random> -#include <vector> -#include <cassert> -#include <functional> -#include <algorithm> - -#define GENERATOR_T generate_unsigned - -namespace { - -struct GENERATOR_T -{ - static constexpr auto char_set = "_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - static constexpr auto max_length = 64; - static constexpr auto min_length = 8; - - auto operator() (std::size_t runs) const - { - assert(runs > 0); - auto engine = std::default_random_engine{42}; - auto dist = std::uniform_int_distribution<unsigned>{}; - auto gen = std::bind(dist, engine); - auto r = std::vector<immer::box<std::string>>(runs); - std::generate_n(r.begin(), runs, [&] { - auto len = gen() % (max_length - min_length) + min_length; - auto str = std::string(len, ' '); - std::generate_n(str.begin(), len, [&] { - return char_set[gen() % sizeof(char_set)]; - }); - return str; - }); - return r; - } -}; - -} // namespace diff --git a/third_party/immer/benchmark/set/string-box/insert.cpp b/third_party/immer/benchmark/set/string-box/insert.cpp deleted file mode 100644 index c5762498c23c..000000000000 --- a/third_party/immer/benchmark/set/string-box/insert.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#define DISABLE_GC_BENCHMARKS -#include "generator.ipp" -#include "../insert.ipp" diff --git a/third_party/immer/benchmark/set/string-box/iter.cpp b/third_party/immer/benchmark/set/string-box/iter.cpp deleted file mode 100644 index 83e57e7845d3..000000000000 --- a/third_party/immer/benchmark/set/string-box/iter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../iter.ipp" diff --git a/third_party/immer/benchmark/set/string-long/access.cpp b/third_party/immer/benchmark/set/string-long/access.cpp deleted file mode 100644 index c3deffbb0636..000000000000 --- a/third_party/immer/benchmark/set/string-long/access.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../access.ipp" diff --git a/third_party/immer/benchmark/set/string-long/generator.ipp b/third_party/immer/benchmark/set/string-long/generator.ipp deleted file mode 100644 index 386364cc96fe..000000000000 --- a/third_party/immer/benchmark/set/string-long/generator.ipp +++ /dev/null @@ -1,44 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <random> -#include <vector> -#include <cassert> -#include <functional> -#include <algorithm> - -#define GENERATOR_T generate_unsigned - -namespace { - -struct GENERATOR_T -{ - static constexpr auto char_set = "_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - static constexpr auto max_length = 256; - static constexpr auto min_length = 32; - - auto operator() (std::size_t runs) const - { - assert(runs > 0); - auto engine = std::default_random_engine{42}; - auto dist = std::uniform_int_distribution<unsigned>{}; - auto gen = std::bind(dist, engine); - auto r = std::vector<std::string>(runs); - std::generate_n(r.begin(), runs, [&] { - auto len = gen() % (max_length - min_length) + min_length; - auto str = std::string(len, ' '); - std::generate_n(str.begin(), len, [&] { - return char_set[gen() % sizeof(char_set)]; - }); - return str; - }); - return r; - } -}; - -} // namespace diff --git a/third_party/immer/benchmark/set/string-long/insert.cpp b/third_party/immer/benchmark/set/string-long/insert.cpp deleted file mode 100644 index c5762498c23c..000000000000 --- a/third_party/immer/benchmark/set/string-long/insert.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#define DISABLE_GC_BENCHMARKS -#include "generator.ipp" -#include "../insert.ipp" diff --git a/third_party/immer/benchmark/set/string-long/iter.cpp b/third_party/immer/benchmark/set/string-long/iter.cpp deleted file mode 100644 index 83e57e7845d3..000000000000 --- a/third_party/immer/benchmark/set/string-long/iter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../iter.ipp" diff --git a/third_party/immer/benchmark/set/string-short/access.cpp b/third_party/immer/benchmark/set/string-short/access.cpp deleted file mode 100644 index c3deffbb0636..000000000000 --- a/third_party/immer/benchmark/set/string-short/access.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../access.ipp" diff --git a/third_party/immer/benchmark/set/string-short/generator.ipp b/third_party/immer/benchmark/set/string-short/generator.ipp deleted file mode 100644 index bd40d2d639a8..000000000000 --- a/third_party/immer/benchmark/set/string-short/generator.ipp +++ /dev/null @@ -1,44 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <random> -#include <vector> -#include <cassert> -#include <functional> -#include <algorithm> - -#define GENERATOR_T generate_unsigned - -namespace { - -struct GENERATOR_T -{ - static constexpr auto char_set = "_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - static constexpr auto max_length = 15; - static constexpr auto min_length = 4; - - auto operator() (std::size_t runs) const - { - assert(runs > 0); - auto engine = std::default_random_engine{42}; - auto dist = std::uniform_int_distribution<unsigned>{}; - auto gen = std::bind(dist, engine); - auto r = std::vector<std::string>(runs); - std::generate_n(r.begin(), runs, [&] { - auto len = gen() % (max_length - min_length) + min_length; - auto str = std::string(len, ' '); - std::generate_n(str.begin(), len, [&] { - return char_set[gen() % sizeof(char_set)]; - }); - return str; - }); - return r; - } -}; - -} // namespace diff --git a/third_party/immer/benchmark/set/string-short/insert.cpp b/third_party/immer/benchmark/set/string-short/insert.cpp deleted file mode 100644 index 26dfbce29204..000000000000 --- a/third_party/immer/benchmark/set/string-short/insert.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../insert.ipp" diff --git a/third_party/immer/benchmark/set/string-short/iter.cpp b/third_party/immer/benchmark/set/string-short/iter.cpp deleted file mode 100644 index 83e57e7845d3..000000000000 --- a/third_party/immer/benchmark/set/string-short/iter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../iter.ipp" diff --git a/third_party/immer/benchmark/set/unsigned/access.cpp b/third_party/immer/benchmark/set/unsigned/access.cpp deleted file mode 100644 index c3deffbb0636..000000000000 --- a/third_party/immer/benchmark/set/unsigned/access.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../access.ipp" diff --git a/third_party/immer/benchmark/set/unsigned/generator.ipp b/third_party/immer/benchmark/set/unsigned/generator.ipp deleted file mode 100644 index 2a2a2a0fb627..000000000000 --- a/third_party/immer/benchmark/set/unsigned/generator.ipp +++ /dev/null @@ -1,32 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <random> -#include <vector> -#include <cassert> -#include <functional> -#include <algorithm> - -#define GENERATOR_T generate_unsigned - -namespace { - -struct GENERATOR_T -{ - auto operator() (std::size_t runs) const - { - assert(runs > 0); - auto engine = std::default_random_engine{42}; - auto dist = std::uniform_int_distribution<unsigned>{}; - auto r = std::vector<unsigned>(runs); - std::generate_n(r.begin(), runs, std::bind(dist, engine)); - return r; - } -}; - -} // namespace diff --git a/third_party/immer/benchmark/set/unsigned/insert.cpp b/third_party/immer/benchmark/set/unsigned/insert.cpp deleted file mode 100644 index 26dfbce29204..000000000000 --- a/third_party/immer/benchmark/set/unsigned/insert.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../insert.ipp" diff --git a/third_party/immer/benchmark/set/unsigned/iter.cpp b/third_party/immer/benchmark/set/unsigned/iter.cpp deleted file mode 100644 index 83e57e7845d3..000000000000 --- a/third_party/immer/benchmark/set/unsigned/iter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "generator.ipp" -#include "../iter.ipp" |