/* * Copyright (C) 2012, Tino Didriksen Consult * Developed by 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 . */ #ifdef _MSC_VER #define _SECURE_SCL 0 #define _CRT_SECURE_NO_DEPRECATE 1 #define WIN32_LEAN_AND_MEAN #define VC_EXTRALEAN #define NOMINMAX #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _MSC_VER #include #endif 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; std::string tmp; 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); #ifdef _MSC_VER runTest< sti::sset >("sti::sset", numbers); #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); #ifdef _MSC_VER runTest< sti::sset >("sti::sset", strings); #endif }