From 031bfbf00328ee779bacc56da6b2153c2a4fb612 Mon Sep 17 00:00:00 2001 From: Jonathan Turkanis Date: Sat, 5 Feb 2005 04:37:24 +0000 Subject: [PATCH] removed incomplete performance tests [SVN r27133] --- performance/file_stream_test.cpp | 17 ------ performance/file_stream_test.hpp | 84 -------------------------- performance/string_stream_test.cpp | 17 ------ performance/string_stream_test.hpp | 96 ------------------------------ 4 files changed, 214 deletions(-) delete mode 100755 performance/file_stream_test.cpp delete mode 100755 performance/file_stream_test.hpp delete mode 100755 performance/string_stream_test.cpp delete mode 100755 performance/string_stream_test.hpp diff --git a/performance/file_stream_test.cpp b/performance/file_stream_test.cpp deleted file mode 100755 index 751e37c..0000000 --- a/performance/file_stream_test.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// (C) Copyright Jonathan Turkanis 2004 -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) - -// See http://www.boost.org/libs/iostreams for documentation. - -#include -#include "./file_stream_test.hpp" - -using boost::unit_test_framework::test_suite; - -test_suite* init_unit_test_suite(int, char* []) -{ - test_suite* test = BOOST_TEST_SUITE("file stream test"); - test->add(BOOST_TEST_CASE(&file_stream_test)); - return test; -} diff --git a/performance/file_stream_test.hpp b/performance/file_stream_test.hpp deleted file mode 100755 index bed96b6..0000000 --- a/performance/file_stream_test.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// (C) Copyright Jonathan Turkanis 2004 -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) - -// See http://www.boost.org/libs/iostreams for documentation. - -#ifndef BOOST_IOSTREAMS_PERF_FILE_STREAM_TEST_HPP_INCLUDED -#define BOOST_IOSTREAMS_PERF_FILE_STREAM_TEST_HPP_INCLUDED - -#define USE_BLOCK_STREAMBUF - -#include -#include -#include -#include -#include -#include -#include -#include "../test/detail/verification.hpp" - -void remove_all(int trials) -{ - char temp_name[30]; - for (int z = 0; z < trials; ++z) { - sprintf(temp_name, "C:/temp/tmp%d", z); - remove(temp_name); - } -} - -void file_stream_test() -{ - using namespace std; - using namespace boost; - using namespace boost::iostreams; - using namespace boost::iostreams::test; - - int trials_per_run = 100; - int runs = 400; - double elapsed1 = 0, elapsed2 = 0; - char temp_name[30]; - - remove_all(trials_per_run); - - for (int w = 0; w < runs; ++w) { - - { - timer t; - stream_facade out; - ios_base::openmode mode = - ios_base::out | ios_base::trunc; - for (int z = 0; z < trials_per_run; ++z) { - sprintf(temp_name, "C:/temp/tmp%d", z); - out.open(file_descriptor_sink(temp_name, mode)); - write_data_in_chunks(out); - out.close(); - } - elapsed1 += t.elapsed(); - } - - remove_all(trials_per_run); - - { - timer t; - std::ofstream out; - std::ios_base::openmode mode = - std::ios_base::out | std::ios_base::trunc; - for (int z = 0; z < trials_per_run; ++z) { - sprintf(temp_name, "C:/temp/tmp%d", z); - out.open(temp_name, mode); - test::write_data_in_chunks(out); - out.close(); - } - elapsed2 += t.elapsed(); - } - - remove_all(trials_per_run); - } - - cout << "total time stream_facade: " << elapsed1 << "s\n"; - cout << "total time std::ofstream: " << elapsed2 << "s\n"; - -} - -#endif // #ifndef BOOST_IOSTREAMS_PERF_FILE_STREAM_TEST_HPP_INCLUDED diff --git a/performance/string_stream_test.cpp b/performance/string_stream_test.cpp deleted file mode 100755 index ffac63f..0000000 --- a/performance/string_stream_test.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// (C) Copyright Jonathan Turkanis 2004 -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) - -// See http://www.boost.org/libs/iostreams for documentation. - -#include -#include "./string_stream_test.hpp" - -using boost::unit_test_framework::test_suite; - -test_suite* init_unit_test_suite(int, char* []) -{ - test_suite* test = BOOST_TEST_SUITE("string stream test"); - test->add(BOOST_TEST_CASE(&string_stream_test)); - return test; -} diff --git a/performance/string_stream_test.hpp b/performance/string_stream_test.hpp deleted file mode 100755 index d2c5d34..0000000 --- a/performance/string_stream_test.hpp +++ /dev/null @@ -1,96 +0,0 @@ -// (C) Copyright Jonathan Turkanis 2004 -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.) - -// See http://www.boost.org/libs/iostreams for documentation. - -#ifndef BOOST_IOSTREAMS_PERF_STRING_STREAM_TEST_HPP_INCLUDED -#define BOOST_IOSTREAMS_PERF_STRING_STREAM_TEST_HPP_INCLUDED - -#define USE_BLOCK_STREAMBUF - -#include -#include -#include -#include -#include -#include -#include -#include -#include "../test/detail/verification.hpp" - -struct string_sink { - typedef char char_type; - typedef boost::iostreams::sink_tag io_category; - typedef boost::iostreams::detail::buffer buffer_type; - string_sink() : buf_(new buffer_type(0)) { } - void write(const char* s, std::streamsize n) - { - int size = (int) (buf().ptr() - buf().begin()); - if (buf().ptr() - buf().begin() + n > buf().size()) - grow(n); - size = (int) (buf().ptr() - buf().begin()); - memcpy(buf().ptr(), s, n); - buf().ptr() += n; - } - void grow(std::streamsize length) - { - length += buf().size(); - length *= 1.5; - boost::iostreams::detail::buffer tmp(length); - std::streamsize valid = - static_cast(buf().ptr() - buf().data()); - tmp.ptr() += valid; - memcpy(tmp.data(), buf().data(), valid); - buf().swap(tmp); - } - std::string str() const - { - return std::string(buf().data(), buf().ptr()); - } - buffer_type& buf() const { return *buf_; } - boost::shared_ptr buf_; -}; - -void string_stream_test() -{ - using namespace std; - using namespace boost; - using namespace boost::iostreams; - using namespace boost::iostreams::test; - typedef container_device seekable_string; - typedef container_device, seekable> seekable_vector; - - int trials_per_run = 100; - int runs = 400; - double elapsed1 = 0, elapsed2 = 0; - - for (int w = 0; w < runs; ++w) { - - { - timer t; - stream_facade out; - for (int z = 0; z < trials_per_run; ++z) { - out.open(string_sink(), 0, 0); - write_data_in_chunks(out); - out.close(); - } - elapsed1 += t.elapsed(); - } - - { - timer t; - std::stringstream out; - for (int z = 0; z < trials_per_run; ++z) { - out.str(""); - write_data_in_chunks(out); - } - elapsed2 += t.elapsed(); - } - } - - cout << "total time stream_facade: " << elapsed1 << "s\n"; - cout << "total time std::stringstream: " << elapsed2 << "s\n"; -} - -#endif // #ifndef BOOST_IOSTREAMS_PERF_STRING_STREAM_TEST_HPP_INCLUDED