/* * Copyright (C) 2015, Tino Didriksen * * This file is part of Benchmarks * * Benchmarks is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Benchmarks is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Benchmarks. If not, see . */ #include #include #include #include #include #include #include #include #include #include #ifdef _MSC_VER #include #endif #include #include #include #include #include #include #include #include const size_t N = 1000000; const size_t R = 7; template void runTest(const std::string& name, const VT& values) { std::cout << "Testing " << name << " ..." << std::endl; std::vector< std::vector > timings(4); for (size_t r=0 ; r numbers; std::vector strings; std::ostringstream ss; for (size_t i=0 ; i\tInsert\tLookup\tIterate\tErase" << std::endl; runTest< std::set >("std::set", numbers); runTest< std::unordered_set >("std::unordered_set", numbers); runTest< boost::unordered_set >("boost::unordered_set", numbers); runTest< CG3::interval_vector >("CG3::interval_vector", numbers); runTest< CG3::sorted_vector >("CG3::sorted_vector", numbers); //runTest< CG3::sorted_deque >("CG3::sorted_deque", numbers); runTest< btree::btree_set >("btree::btree_set", numbers); //runTest< btree::safe_btree_set >("btree::safe_btree_set", numbers); #ifdef _MSC_VER runTest< sti::sset >("sti::sset", numbers); #else runTest< boost::container::flat_set >("boost::container::flat_set", numbers); // Broken Boost 1.55.0 vs. VS12? #endif std::cout << "\tInsert\tLookup\tIterate\tErase" << std::endl; runTest< std::set >("std::set", strings); runTest< std::unordered_set >("std::unordered_set", strings); runTest< boost::unordered_set >("boost::unordered_set", strings); //runTest< CG3::interval_vector >("CG3::interval_vector", strings); // only makes sense for integers runTest< CG3::sorted_vector >("CG3::sorted_vector", strings); //runTest< CG3::sorted_deque >("CG3::sorted_deque", strings); runTest< tdc::trie >("tdc::trie", strings); runTest< btree::btree_set >("btree::btree_set", strings); //runTest< btree::safe_btree_set >("btree::safe_btree_set", strings); #ifdef _MSC_VER runTest< sti::sset >("sti::sset", strings); #else runTest< boost::container::flat_set >("boost::container::flat_set", strings); // Broken Boost 1.55.0 vs. VS12? #endif }