Reshuffle performance testsuite.
authorPaolo Carlini <pcarlini@suse.de>
Fri, 30 Jan 2004 17:06:42 +0000 (17:06 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 30 Jan 2004 17:06:42 +0000 (17:06 +0000)
2004-01-30  Paolo Carlini  <pcarlini@suse.de>

Reshuffle performance testsuite.
* testsuite/performance/allocator.cc, allocator_map_thread.cc,
allocator_thread.cc, complex_norm.cc, container_benchmark.cc,
cout_insert_int.cc, filebuf_copy.cc, filebuf_sputc.cc,
fstream_seek_write.cc, ifstream_extract_float.cc,
ifstream_extract_int.cc, ifstream_getline.cc, is_wchar_t.cc,
list_create_fill_sort.cc, map_create_fill.cc,
narrow_widen_char.cc, narrow_widen_wchar_t.cc,
ofstream_insert_float.cc, ofstream_insert_int.cc,
string_append.cc, wchar_t_in.cc, wchar_t_length.cc,
wchar_t_out.cc: Split into...
* testsuite/performance/20_util/allocator.cc: New.
* testsuite/performance/20_util/allocator_map_thread.cc: New.
* testsuite/performance/20_util/allocator_thread.cc: New.
* testsuite/performance/21_strings/string_append: New.
* testsuite/performance/22_locale/is_wchar_t.cc: New.
* testsuite/performance/22_locale/narrow_widen_char.cc: New.
* testsuite/performance/22_locale/narrow_widen_wchar_t.cc: New.
* testsuite/performance/22_locale/wchar_t_in.cc: New.
* testsuite/performance/22_locale/wchar_t_length.cc: New.
* testsuite/performance/22_locale/wchar_t_out.cc: New.
* testsuite/performance/23_containers/container_benchmark.cc: New.
* testsuite/performance/23_containers/list_create_fill_sort.cc: New.
* testsuite/performance/23_containers/map_create_fill.cc: New.
* testsuite/performance/26_numerics/complex_norm.cc: New.
* testsuite/performance/27_io/cout_insert_int.cc: New.
* testsuite/performance/27_io/filebuf_copy.cc: New.
* testsuite/performance/27_io/filebuf_sputc.cc: New.
* testsuite/performance/27_io/fstream_seek_write.cc: New.
* testsuite/performance/27_io/ifstream_extract_float.cc: New.
* testsuite/performance/27_io/ifstream_extract_int.cc: New.
* testsuite/performance/27_io/ifstream_getline.cc: New.
* testsuite/performance/27_io/ofstream_insert_float.cc: New.
* testsuite/performance/27_io/ofstream_insert_int.cc: New.

From-SVN: r76974

47 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/performance/20_util/allocator.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/20_util/allocator_map_thread.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/20_util/allocator_thread.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/21_strings/string_append.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/22_locale/is_wchar_t.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/22_locale/narrow_widen_char.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/22_locale/narrow_widen_wchar_t.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/22_locale/wchar_t_in.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/22_locale/wchar_t_length.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/22_locale/wchar_t_out.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/23_containers/container_benchmark.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/23_containers/list_create_fill_sort.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/23_containers/map_create_fill.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/26_numerics/complex_norm.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/cout_insert_int.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/filebuf_copy.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/filebuf_sputc.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/fstream_seek_write.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/ifstream_extract_float.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/ifstream_extract_int.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/ifstream_getline.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/ofstream_insert_float.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/27_io/ofstream_insert_int.cc [new file with mode: 0644]
libstdc++-v3/testsuite/performance/allocator.cc [deleted file]
libstdc++-v3/testsuite/performance/allocator_map_thread.cc [deleted file]
libstdc++-v3/testsuite/performance/allocator_thread.cc [deleted file]
libstdc++-v3/testsuite/performance/complex_norm.cc [deleted file]
libstdc++-v3/testsuite/performance/container_benchmark.cc [deleted file]
libstdc++-v3/testsuite/performance/cout_insert_int.cc [deleted file]
libstdc++-v3/testsuite/performance/filebuf_copy.cc [deleted file]
libstdc++-v3/testsuite/performance/filebuf_sputc.cc [deleted file]
libstdc++-v3/testsuite/performance/fstream_seek_write.cc [deleted file]
libstdc++-v3/testsuite/performance/ifstream_extract_float.cc [deleted file]
libstdc++-v3/testsuite/performance/ifstream_extract_int.cc [deleted file]
libstdc++-v3/testsuite/performance/ifstream_getline.cc [deleted file]
libstdc++-v3/testsuite/performance/is_wchar_t.cc [deleted file]
libstdc++-v3/testsuite/performance/list_create_fill_sort.cc [deleted file]
libstdc++-v3/testsuite/performance/map_create_fill.cc [deleted file]
libstdc++-v3/testsuite/performance/narrow_widen_char.cc [deleted file]
libstdc++-v3/testsuite/performance/narrow_widen_wchar_t.cc [deleted file]
libstdc++-v3/testsuite/performance/ofstream_insert_float.cc [deleted file]
libstdc++-v3/testsuite/performance/ofstream_insert_int.cc [deleted file]
libstdc++-v3/testsuite/performance/string_append.cc [deleted file]
libstdc++-v3/testsuite/performance/wchar_t_in.cc [deleted file]
libstdc++-v3/testsuite/performance/wchar_t_length.cc [deleted file]
libstdc++-v3/testsuite/performance/wchar_t_out.cc [deleted file]

index 0273958d79ecb006c2069f3edc3b0ce49dbacf8f..b0d610f6484c7c4857507c684b97d3b40c7bab94 100644 (file)
@@ -1,3 +1,40 @@
+2004-01-30  Paolo Carlini  <pcarlini@suse.de>
+
+       Reshuffle performance testsuite.
+       * testsuite/performance/allocator.cc, allocator_map_thread.cc,
+       allocator_thread.cc, complex_norm.cc, container_benchmark.cc,
+       cout_insert_int.cc, filebuf_copy.cc, filebuf_sputc.cc,
+       fstream_seek_write.cc, ifstream_extract_float.cc,
+       ifstream_extract_int.cc, ifstream_getline.cc, is_wchar_t.cc,
+       list_create_fill_sort.cc, map_create_fill.cc,
+       narrow_widen_char.cc, narrow_widen_wchar_t.cc,
+       ofstream_insert_float.cc, ofstream_insert_int.cc,
+       string_append.cc, wchar_t_in.cc, wchar_t_length.cc,
+       wchar_t_out.cc: Split into...
+       * testsuite/performance/20_util/allocator.cc: New.
+       * testsuite/performance/20_util/allocator_map_thread.cc: New.
+       * testsuite/performance/20_util/allocator_thread.cc: New.
+       * testsuite/performance/21_strings/string_append: New.
+       * testsuite/performance/22_locale/is_wchar_t.cc: New.
+       * testsuite/performance/22_locale/narrow_widen_char.cc: New.
+       * testsuite/performance/22_locale/narrow_widen_wchar_t.cc: New.
+       * testsuite/performance/22_locale/wchar_t_in.cc: New.
+       * testsuite/performance/22_locale/wchar_t_length.cc: New.
+       * testsuite/performance/22_locale/wchar_t_out.cc: New.
+       * testsuite/performance/23_containers/container_benchmark.cc: New.
+       * testsuite/performance/23_containers/list_create_fill_sort.cc: New.
+       * testsuite/performance/23_containers/map_create_fill.cc: New.
+       * testsuite/performance/26_numerics/complex_norm.cc: New.
+       * testsuite/performance/27_io/cout_insert_int.cc: New.
+       * testsuite/performance/27_io/filebuf_copy.cc: New.
+       * testsuite/performance/27_io/filebuf_sputc.cc: New.
+       * testsuite/performance/27_io/fstream_seek_write.cc: New.
+       * testsuite/performance/27_io/ifstream_extract_float.cc: New.
+       * testsuite/performance/27_io/ifstream_extract_int.cc: New.
+       * testsuite/performance/27_io/ifstream_getline.cc: New.
+       * testsuite/performance/27_io/ofstream_insert_float.cc: New.
+       * testsuite/performance/27_io/ofstream_insert_int.cc: New.
+
 2004-01-30  Paolo Carlini  <pcarlini@suse.de>
 
        * include/bits/basic_string.tcc (_Rep::_S_create):
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator.cc b/libstdc++-v3/testsuite/performance/20_util/allocator.cc
new file mode 100644 (file)
index 0000000..5f864ea
--- /dev/null
@@ -0,0 +1,139 @@
+// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/*
+ * The goal with this application is to compare the performance
+ * between different std::allocator implementations. The results are
+ * influenced by the underlying allocator in the "C" library, malloc.
+ */
+
+// 2003-02-05 Stefan Olsson <stefan@snon.net>
+
+#include <vector>
+#include <list>
+#include <typeinfo>
+#include <sstream>
+#include <ext/mt_allocator.h>
+#include <ext/new_allocator.h>
+#include <ext/malloc_allocator.h>
+#include <cxxabi.h>
+#include <testsuite_performance.h>
+
+using namespace std;
+using __gnu_cxx::__mt_alloc;
+using __gnu_cxx::new_allocator;
+using __gnu_cxx::malloc_allocator;
+
+typedef int test_type;
+
+// The number of iterations to be performed.
+int iterations = 100000;
+
+// The number of values to insert in the container, 32 will cause 5
+// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
+// This means that all allocations are within _MAX_BYTES = 128 as
+// defined in stl_alloc.h for __pool_alloc.  Whether or not this
+// value is relevant in "the real world" or not I don't know and
+// should probably be investigated in more detail.
+int insert_values = 128;
+
+template<typename Container>
+  int
+  do_loop()
+  {
+    int test_iterations = 0;
+    try
+      {
+       Container obj;
+       while (test_iterations < iterations)
+         {
+           for (int j = 0; j < insert_values; ++j)
+             obj.push_back(test_iterations);
+           ++test_iterations;
+         }
+      }
+    catch(...)
+      {
+       // No point allocating all available memory, repeatedly.        
+      }
+    return test_iterations;
+  }
+
+template<typename Container>
+  void
+  test_container(Container obj)
+  {
+    using namespace __gnu_test;
+    int status;
+
+    time_counter time;
+    resource_counter resource;
+    clear_counters(time, resource);
+    start_counters(time, resource);
+    int test_iterations = do_loop<Container>();
+    stop_counters(time, resource);
+    std::ostringstream comment;
+    comment << "iterations: " << test_iterations << '\t';
+    comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
+                                              0, 0, &status);
+    report_header(__FILE__, comment.str());
+    report_performance(__FILE__, string(), time, resource);
+  }
+
+// http://gcc.gnu.org/ml/libstdc++/2001-05/msg00105.html
+// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
+int main(void)
+{
+#ifdef TEST_B1
+  test_container(vector<test_type>());
+#endif
+#ifdef TEST_B2
+  test_container(vector<test_type, malloc_allocator<test_type> >());
+#endif
+#ifdef TEST_B3
+  test_container(vector<test_type, new_allocator<test_type> >());
+#endif
+#ifdef TEST_B4
+  test_container(vector<test_type, __mt_alloc<test_type> >());
+#endif
+
+#ifdef TEST_B5
+  test_container(list<test_type>());
+#endif
+#ifdef TEST_B6
+  test_container(list<test_type, malloc_allocator<test_type> >());
+#endif
+#ifdef TEST_B7
+  test_container(list<test_type, new_allocator<test_type> >());
+#endif
+#ifdef TEST_B8
+  test_container(list<test_type, __mt_alloc<test_type> >());
+#endif
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator_map_thread.cc b/libstdc++-v3/testsuite/performance/20_util/allocator_map_thread.cc
new file mode 100644 (file)
index 0000000..f6b4d45
--- /dev/null
@@ -0,0 +1,125 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/*
+ * The goal with this application is to compare the performance
+ * between different std::allocator implementations. The results are
+ * influenced by the underlying allocator in the "C" library, malloc.
+ */
+
+// libstdc++/13823 recast for this testing framework
+
+#include <map>
+#include <iostream>
+#include <typeinfo>
+#include <sstream>
+#include <ext/mt_allocator.h>
+#include <ext/new_allocator.h>
+#include <ext/malloc_allocator.h>
+#include <cxxabi.h>
+#include <testsuite_performance.h>
+
+using namespace std;
+using __gnu_cxx::__mt_alloc;
+using __gnu_cxx::new_allocator;
+using __gnu_cxx::malloc_allocator;
+
+// The number of iterations to be performed.
+int iterations = 25000;
+
+template<typename Container>
+  void*
+  do_loop(void* p = NULL)
+  {
+    try
+      {
+       for (int c = 0; c < 10; c++)
+         {
+           Container m;
+
+           for (unsigned i = 0; i < iterations; ++i) 
+             m[i] = i;
+         }
+      }
+    catch(...)
+      {
+       // No point allocating all available memory, repeatedly.        
+      }
+  }
+
+template<typename Container>
+  void
+  test_container(Container obj)
+  {
+    using namespace __gnu_test;
+    int status;
+
+    time_counter time;
+    resource_counter resource;
+
+    clear_counters(time, resource);
+    start_counters(time, resource);
+    
+    pthread_t  t1, t2, t3, t4;
+    pthread_create(&t1, NULL, &do_loop<Container>, NULL);
+    pthread_create(&t2, NULL, &do_loop<Container>, NULL);
+    pthread_create(&t3, NULL, &do_loop<Container>, NULL);
+    pthread_create(&t4, NULL, &do_loop<Container>, NULL);
+
+    pthread_join(t1, NULL);
+    pthread_join(t2, NULL);
+    pthread_join(t3, NULL);
+    pthread_join(t4, NULL);
+
+    stop_counters(time, resource);
+    std::ostringstream comment;
+    comment << "iterations: " << iterations << '\t';
+    comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
+                                              0, 0, &status);
+    report_header(__FILE__, comment.str());
+    report_performance(__FILE__, string(), time, resource);
+  }
+
+int main(void)
+{
+#ifdef TEST_T1
+  test_container(map<int, int>());
+#endif
+#ifdef TEST_T2
+  test_container(map<int, int, less<const int>, new_allocator<int> >());
+#endif
+#ifdef TEST_T3
+  test_container(map<int, int, less<const int>, malloc_allocator<int> >());
+#endif
+#ifdef TEST_T4
+  test_container(map<int, int, less<const int>,
+                     __mt_alloc< pair<const int, int> > >());
+#endif
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator_thread.cc b/libstdc++-v3/testsuite/performance/20_util/allocator_thread.cc
new file mode 100644 (file)
index 0000000..b313a1f
--- /dev/null
@@ -0,0 +1,159 @@
+// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/*
+ * The goal with this application is to compare the performance
+ * between different std::allocator implementations. The results are
+ * influenced by the underlying allocator in the "C" library, malloc.
+ */
+
+// 2003-02-05 Stefan Olsson <stefan@snon.net>
+
+#include <vector>
+#include <list>
+#include <typeinfo>
+#include <sstream>
+#include <pthread.h>
+#include <ext/mt_allocator.h>
+#include <ext/new_allocator.h>
+#include <ext/malloc_allocator.h>
+#include <cxxabi.h>
+#include <testsuite_performance.h>
+
+using namespace std;
+using __gnu_cxx::__mt_alloc;
+using __gnu_cxx::new_allocator;
+using __gnu_cxx::malloc_allocator;
+
+typedef int test_type;
+
+// The number of iterations to be performed.
+int iterations = 25000;
+
+// The number of values to insert in the container, 32 will cause 5
+// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
+// This means that all allocations are within _MAX_BYTES = 128 as
+// defined in stl_alloc.h for __pool_alloc.  Whether or not this
+// value is relevant in "the real world" or not I don't know and
+// should probably be investigated in more detail.
+int insert_values = 128;
+
+template<typename Container>
+  void*
+  do_loop(void* p = NULL)
+  {
+    Container obj;    
+    try
+      {
+       int test_iterations = 0;
+       while (test_iterations < iterations)
+         {
+           for (int j = 0; j < insert_values; ++j)
+             obj.push_back(test_iterations);
+           ++test_iterations;
+         }
+       obj.clear();
+       test_iterations = 0;
+       while (test_iterations < iterations)
+         {
+           for (int j = 0; j < insert_values; ++j)
+             obj.push_back(test_iterations);
+           ++test_iterations;
+         }
+      }
+    catch(...)
+      {
+       // No point allocating all available memory, repeatedly.        
+      }
+  }
+
+template<typename Container>
+  void
+  test_container(Container obj)
+  {
+    using namespace __gnu_test;
+    int status;
+
+    time_counter time;
+    resource_counter resource;
+
+    clear_counters(time, resource);
+    start_counters(time, resource);
+    
+    pthread_t  t1, t2, t3, t4;
+    pthread_create(&t1, 0, &do_loop<Container>, 0);
+    pthread_create(&t2, 0, &do_loop<Container>, 0);
+    pthread_create(&t3, 0, &do_loop<Container>, 0);
+    pthread_create(&t4, 0, &do_loop<Container>, 0);
+
+    pthread_join(t1, NULL);
+    pthread_join(t2, NULL);
+    pthread_join(t3, NULL);
+    pthread_join(t4, NULL);
+
+    stop_counters(time, resource);
+    std::ostringstream comment;
+    comment << "iterations: " << iterations << '\t';
+    comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
+                                              0, 0, &status);
+    report_header(__FILE__, comment.str());
+    report_performance(__FILE__, string(), time, resource);
+  }
+
+// http://gcc.gnu.org/ml/libstdc++/2001-05/msg00105.html
+// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
+int main(void)
+{
+#ifdef TEST_T1
+  test_container(vector<test_type>());
+#endif
+#ifdef TEST_T2
+  test_container(vector<test_type, malloc_allocator<test_type> >());
+#endif
+#ifdef TEST_T3
+  test_container(vector<test_type, new_allocator<test_type> >());
+#endif
+#ifdef TEST_T4
+  test_container(vector<test_type, __mt_alloc<test_type> >());
+#endif
+
+#ifdef TEST_T5
+  test_container(list<test_type>());
+#endif
+#ifdef TEST_T6
+  test_container(list<test_type, malloc_allocator<test_type> >());
+#endif
+#ifdef TEST_T7
+  test_container(list<test_type, new_allocator<test_type> >());
+#endif
+#ifdef TEST_T8
+  test_container(list<test_type, __mt_alloc<test_type> >());
+#endif
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/21_strings/string_append.cc b/libstdc++-v3/testsuite/performance/21_strings/string_append.cc
new file mode 100644 (file)
index 0000000..fccd82c
--- /dev/null
@@ -0,0 +1,86 @@
+ // Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <ctime>
+#include <iostream>
+#include <string>
+#include <testsuite_performance.h>
+
+using namespace std;
+
+void
+test_append_char(int how_much)
+{
+  string buf; // no preallocation
+  for (int i = 0; i < how_much; ++i)
+    buf.append(static_cast<string::size_type>(1) , 'x');
+}
+
+void
+test_append_string(int how_much)
+{
+  string s(static_cast<string::size_type>(1) , 'x');
+  string buf; // no preallocation
+  for (int i = 0; i < how_much; ++i)
+    buf.append(s);
+}
+
+void 
+run_benchmark1(int how_much)
+{
+  using namespace __gnu_test;
+  time_counter time;
+  resource_counter resource;
+  start_counters(time, resource);
+  test_append_char(how_much);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "char", time, resource);
+}
+
+void 
+run_benchmark2(int how_much)
+{
+  using namespace __gnu_test;
+  time_counter time;
+  resource_counter resource;
+  start_counters(time, resource);
+  test_append_string(how_much);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "string", time, resource);
+}
+
+// libstdc++/5380
+// libstdc++/4960
+int main()
+{
+  run_benchmark1(100000);
+  run_benchmark2(100000);
+  run_benchmark1(1000000);
+  run_benchmark2(1000000);
+  run_benchmark1(10000000);
+  run_benchmark2(10000000);
+}
diff --git a/libstdc++-v3/testsuite/performance/22_locale/is_wchar_t.cc b/libstdc++-v3/testsuite/performance/22_locale/is_wchar_t.cc
new file mode 100644 (file)
index 0000000..e35edd0
--- /dev/null
@@ -0,0 +1,87 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <locale>
+#include <cwctype>
+#include <cstddef>
+#include <testsuite_performance.h>
+
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const wchar_t str[] =
+    L"Is this the real life?\n"
+    L"Is this just fantasy?\n"
+    L"Caught in a landslide\n"
+    L"No escape from reality\n"
+    L"Open your eyes\n"
+    L"Look up to the skies and see\n"
+    L"I'm just a poor boy\n"
+    L"I need no sympathy\n"
+    L"Because I'm easy come, easy go\n"
+    L"Little high, little low"
+    L"Anyway the wind blows\n"
+    L"Doesn't really matter to me\n"
+    L"To me\n"
+    L"                      -- Queen\n";
+  const size_t len = sizeof(str) / sizeof(str[0]) - 1;
+
+  locale loc;
+  const ctype<wchar_t>& ct = use_facet<ctype<wchar_t> >(loc);
+
+  // C
+  wctype_t w = wctype("space");
+  start_counters(time, resource);
+  for (int j = 0; j < 200000; ++j)
+    {
+      for (size_t i = 0; i < len; ++i)
+       {
+         iswctype(str[i], w);
+       }
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "C", time, resource);
+  clear_counters(time, resource);
+
+  // C++
+  start_counters(time, resource);
+  for (int j = 0; j < 200000; ++j)
+    {
+      for (size_t i = 0; i < len; ++i)
+       {
+         ct.is(ctype_base::space, str[i]);
+       }
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "C++", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/22_locale/narrow_widen_char.cc b/libstdc++-v3/testsuite/performance/22_locale/narrow_widen_char.cc
new file mode 100644 (file)
index 0000000..f8b530d
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <locale>
+#include <testsuite_performance.h>
+
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  char bufin[] = "This was an attempt to bypass string construction just for test.";
+  char bufout[sizeof(bufin)];
+
+  locale loc;
+  const ctype<char>& ct = use_facet<ctype<char> >(loc);
+
+  // narrow
+  start_counters(time, resource);
+  for (long i = 0; i < 1000000000; ++i)
+    ct.narrow(i % 128, '*');
+  stop_counters(time, resource);
+  report_performance(__FILE__, "narrow", time, resource);
+  clear_counters(time, resource);
+
+  // narrow array
+  start_counters(time, resource);
+  for (long i = 0; i < 100000000; ++i)
+    ct.narrow(bufin, bufin+sizeof(bufin), '*', bufout);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "narrow_array", time, resource);
+  clear_counters(time, resource);
+
+  // widen
+  start_counters(time, resource);
+  for (long i = 0; i < 1000000000; ++i)
+    ct.widen(i % 128);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "widen", time, resource);
+  clear_counters(time, resource);
+
+  // widen array
+  start_counters(time, resource);
+  for (long i = 0; i < 100000000; ++i)
+    ct.widen(bufin, bufin+sizeof(bufin), bufout);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "widen_array", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/22_locale/narrow_widen_wchar_t.cc b/libstdc++-v3/testsuite/performance/22_locale/narrow_widen_wchar_t.cc
new file mode 100644 (file)
index 0000000..f5d4536
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <locale>
+#include <testsuite_performance.h>
+
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  wchar_t bufwc[] = L"Mi innamoravo di tutto (Fabrizio De Andre')";
+  char bufc[sizeof(bufwc) / sizeof(wchar_t)];
+
+  locale loc;
+  const ctype<wchar_t>& ct = use_facet<ctype<wchar_t> >(loc);
+
+  // narrow
+  start_counters(time, resource);
+  for (long i = 0; i < 200000000; ++i)
+    ct.narrow(i % 128, '*');
+  stop_counters(time, resource);
+  report_performance(__FILE__, "narrow", time, resource);
+  clear_counters(time, resource);
+
+  // narrow array
+  start_counters(time, resource);
+  for (long i = 0; i < 20000000; ++i)
+    ct.narrow(bufwc, bufwc + sizeof(bufwc) / sizeof(wchar_t), '*', bufc);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "narrow array", time, resource);
+  clear_counters(time, resource);
+
+  // widen
+  start_counters(time, resource);
+  for (long i = 0; i < 200000000; ++i)
+    ct.widen(i % 128);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "widen", time, resource);
+  clear_counters(time, resource);
+
+  // widen array
+  start_counters(time, resource);
+  for (long i = 0; i < 20000000; ++i)
+    ct.widen(bufc, bufc + sizeof(bufc), bufwc);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "widen array", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/22_locale/wchar_t_in.cc b/libstdc++-v3/testsuite/performance/22_locale/wchar_t_in.cc
new file mode 100644 (file)
index 0000000..43e09e3
--- /dev/null
@@ -0,0 +1,84 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <cstring>
+#include <fstream>
+#include <langinfo.h>
+#include <iconv.h>
+#include <testsuite_performance.h>
+
+// libstdc++/11602 (do_in)
+int main(int argc, char** argv)
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iters = 400000;
+
+  wchar_t wbuf[1024];
+  char cbuf[1024];
+  
+  memset(cbuf, 'a', 1024);
+
+  // C (iconv)
+  iconv_t cd = iconv_open("WCHAR_T", nl_langinfo(CODESET));
+  start_counters(time, resource);
+  for (int i = 0; i < iters; ++i)
+    {
+      size_t inbytesleft = 1024;
+      size_t outbytesleft = 1024 * sizeof(wchar_t);
+      char* in = cbuf;
+      char* out = reinterpret_cast<char*>(wbuf);
+      iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
+    }
+  stop_counters(time, resource);
+  iconv_close(cd);
+  report_performance(__FILE__, "C (iconv)", time, resource);
+  clear_counters(time, resource);
+
+  // C++ (codecvt)
+  locale loc;
+  const codecvt<wchar_t, char, mbstate_t>& cvt =
+    use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+  mbstate_t state;
+  memset(&state, 0, sizeof(state));
+  start_counters(time, resource);
+  for (int i = 0; i < iters; ++i)
+    {
+      const char* from_next;
+      wchar_t* to_next;
+      cvt.in(state, cbuf, cbuf + 1024, from_next,
+            wbuf, wbuf + 1024, to_next);
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "C++ (codecvt)", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/22_locale/wchar_t_length.cc b/libstdc++-v3/testsuite/performance/22_locale/wchar_t_length.cc
new file mode 100644 (file)
index 0000000..f0146fe
--- /dev/null
@@ -0,0 +1,62 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <cstring>
+#include <fstream>
+#include <langinfo.h>
+#include <iconv.h>
+#include <testsuite_performance.h>
+
+// libstdc++/11602 (do_length)
+int main(int argc, char** argv)
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iters = 400000;
+
+  char cbuf[1024];
+  
+  memset(cbuf, 'a', 1024);
+
+  // C++ (codecvt)
+  locale loc;
+  const codecvt<wchar_t, char, mbstate_t>& cvt =
+    use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+  mbstate_t state;
+  memset(&state, 0, sizeof(state));
+  start_counters(time, resource);
+  for (int i = 0; i < iters; ++i)
+    cvt.length(state, cbuf, cbuf + 1024, 1024);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "C++ (codecvt)", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/22_locale/wchar_t_out.cc b/libstdc++-v3/testsuite/performance/22_locale/wchar_t_out.cc
new file mode 100644 (file)
index 0000000..4e51068
--- /dev/null
@@ -0,0 +1,84 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <cstring>
+#include <fstream>
+#include <langinfo.h>
+#include <iconv.h>
+#include <testsuite_performance.h>
+
+// libstdc++/11602
+int main(int argc, char** argv)
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iters = 300000;
+
+  wchar_t wbuf[1024];
+  char cbuf[1024];
+  
+  wmemset(wbuf, L'a', 1024);
+
+  // C (iconv)
+  iconv_t cd = iconv_open(nl_langinfo(CODESET), "WCHAR_T");
+  start_counters(time, resource);
+  for (int i = 0; i < iters; ++i)
+    {
+      size_t inbytesleft = 1024 * sizeof(wchar_t);
+      size_t outbytesleft = 1024;
+      char* in = reinterpret_cast<char*>(wbuf);
+      char* out = cbuf;
+      iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
+    }
+  stop_counters(time, resource);
+  iconv_close(cd);
+  report_performance(__FILE__, "C (iconv)", time, resource);
+  clear_counters(time, resource);
+
+  // C++ (codecvt)
+  locale loc;
+  const codecvt<wchar_t, char, mbstate_t>& cvt =
+    use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+  mbstate_t state;
+  memset(&state, 0, sizeof(state));
+  start_counters(time, resource);
+  for (int i = 0; i < iters; ++i)
+    {
+      const wchar_t* from_next;
+      char* to_next;
+      cvt.out(state, wbuf, wbuf + 1024, from_next,
+             cbuf, cbuf + 1024, to_next);
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "C++ (codecvt)", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/23_containers/container_benchmark.cc b/libstdc++-v3/testsuite/performance/23_containers/container_benchmark.cc
new file mode 100644 (file)
index 0000000..4e54374
--- /dev/null
@@ -0,0 +1,175 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cmath>
+#include <cstdlib>
+
+#include <vector>
+#include <algorithm>
+#include <list>
+#include <deque>
+#include <set>
+
+#include <sstream>
+#include <testsuite_performance.h>
+
+using namespace std;
+
+typedef double element_t;
+typedef void(*test)(element_t*, element_t*);
+
+void array_test(element_t* first, element_t* last)
+{
+  element_t* array = new element_t[last - first];
+  copy(first, last, array);
+  sort(array, array + (last - first));
+  unique(array, array + (last - first));
+  delete [] array;       
+}
+
+void vector_pointer_test(element_t* first, element_t* last)
+{ 
+  vector<element_t> container(first, last);
+  sort(&*container.begin(), &*container.end());
+  unique(&*container.begin(), &*container.end());
+}
+
+void vector_iterator_test(element_t* first, element_t* last)
+{
+  vector<element_t> container(first, last);
+  sort(container.begin(), container.end());
+  unique(container.begin(), container.end());
+}
+
+void deque_test(element_t* first, element_t* last)
+{  
+  deque<element_t> container(first, last);
+  copy(first, last, container.begin()); 
+  sort(container.begin(), container.end());
+  unique(container.begin(), container.end());
+}
+    
+void list_test(element_t* first, element_t* last)
+{ 
+  list<element_t> container(first, last);
+  container.sort();
+  container.unique();
+}
+void set_test(element_t* first, element_t* last)
+{ set<element_t> container(first, last); }
+
+void multiset_test(element_t* first, element_t* last)
+{
+  multiset<element_t> container(first, last);
+  typedef multiset<element_t>::iterator iterator;
+  {
+    iterator first = container.begin();
+    iterator last = container.end();
+    
+    while (first != last)
+      {
+       iterator next = first;
+       if (++next == last) break;
+       if (*first == *next)
+         container.erase(next);
+       else
+         ++first;
+      }
+  }
+}
+
+double logtwo(double x)
+{ return log(x)/log(2.0); }
+
+int number_of_tests(int size)
+{
+  const double n = size;
+  const double largest_n = 1000000;
+  return int(floor((largest_n * logtwo(largest_n))
+                  / (n * logtwo(n))));
+}
+
+void initialize(element_t* first, element_t* last)
+{
+  element_t value = 0.0;
+  while (first != last)
+    {
+      *first++ = value;
+      value += 1.;
+    }
+}
+
+void run_tests(int size, const test* tests, const char** names,
+              int ntests)
+{
+  using namespace __gnu_test;
+  time_counter time;
+  resource_counter resource;
+
+  const int n = number_of_tests(size);
+  const size_t length = 2 * size;
+
+  // make a random test set of the chosen size:
+  vector<element_t> buf(length);
+  element_t* buffer = &buf[0];
+  element_t* buffer_end = &buf[length];
+  initialize(buffer, buffer + size);    // elements
+  initialize(buffer + size, buffer_end); // duplicate elements
+  random_shuffle(buffer, buffer_end);
+
+  // test the containers:
+  ostringstream oss;
+  oss << "size = " << size << " :";
+  report_header(__FILE__, oss.str());
+  for (int i = 0; i < ntests; ++i)
+    {
+      start_counters(time, resource);
+      for (int j = 0; j < n; ++j)
+       tests[i](buffer, buffer_end);
+      stop_counters(time, resource);
+      report_performance(__FILE__, names[i], time, resource);
+      clear_counters(time, resource);
+    }
+}
+
+int main()
+{
+  const test tests[] = { &array_test, &vector_pointer_test,
+                        &vector_iterator_test, &deque_test,
+                        &list_test, &set_test, &multiset_test };
+  const int ntests = sizeof(tests) / sizeof(test);
+  const char* names[ntests] = { "array", "vector (pointer)",
+                               "vector (iterator)", "deque",
+                               "list", "set", "multiset" };
+
+  const int sizes[] = {100, 1000, 10000, 100000};
+  for (int i = 0; i < sizeof(sizes) / sizeof(int); ++i)
+    run_tests(sizes[i], tests, names, ntests);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/23_containers/list_create_fill_sort.cc b/libstdc++-v3/testsuite/performance/23_containers/list_create_fill_sort.cc
new file mode 100644 (file)
index 0000000..8999b43
--- /dev/null
@@ -0,0 +1,64 @@
+// 2003-07-07 gp dot bolton at computer dot org
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <list>
+#include <testsuite_hooks.h>
+#include <testsuite_performance.h>
+
+
+static void create_and_fill_and_sort(const unsigned int n)
+{
+  typedef std::list<int>  List;
+  List                    l;
+  
+  for (unsigned int i = 0; i < n; ++i)
+  {
+      l.push_back(n - i);
+  }
+  l.sort();
+}
+
+
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  char comment[80];
+
+  for (unsigned int n = 1; n <= 1000; n *= 10)
+  {
+      const unsigned int iterations = 10000000/n;
+
+      start_counters(time, resource);
+
+      for (unsigned int i = 0; i < iterations; ++i)
+      {
+         create_and_fill_and_sort( n );
+      }
+      stop_counters(time, resource);
+
+      sprintf(comment,"Iters: %8u  Size: %4u", iterations, n);
+      report_performance(__FILE__, comment, time, resource);
+  }
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/23_containers/map_create_fill.cc b/libstdc++-v3/testsuite/performance/23_containers/map_create_fill.cc
new file mode 100644 (file)
index 0000000..0e675d0
--- /dev/null
@@ -0,0 +1,53 @@
+// 2003-03-01 gp dot bolton at computer dot org
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+#include <map>
+#include <testsuite_hooks.h>
+#include <testsuite_performance.h>
+
+static void create_and_fill(const unsigned int n)
+{
+  typedef std::map<int, int>  Map;
+  Map                         m;
+  bool test __attribute__((unused)) = true;
+  
+  for (unsigned int i = 0; i < n; ++i)
+    m[i] = i;
+  VERIFY( m.size() == n );
+}
+
+// http://gcc.gnu.org/ml/libstdc++/2003-03/msg00000.html
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 100000000;
+  
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i)
+    create_and_fill( 0 );
+  stop_counters(time, resource);
+  report_performance(__FILE__, "", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/26_numerics/complex_norm.cc b/libstdc++-v3/testsuite/performance/26_numerics/complex_norm.cc
new file mode 100644 (file)
index 0000000..6ed280c
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <complex>
+#include <testsuite_performance.h>
+
+// based on libstdc++/5730, use --fast-math
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 2000;
+
+  typedef complex<double> complex_type;
+  complex_type u[2048];
+
+  for (int i = 0; i < 2048; ++i)
+    u[i] = 1.0;
+
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i) 
+    {
+      complex_type * p = u;
+      for (int j = 0; j < 2048; ++j) 
+       {
+         double u2 = norm(*p);
+         double t = u2 * 0.1;
+         *p *= complex_type(cos(t), sin(t));
+         ++p;
+       }
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "norm", time, resource);
+  clear_counters(time, resource);
+
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i) 
+    {
+      complex_type * p = u;
+      for (int j = 0; j < 2048; ++j) 
+       {
+         // Shouldn't be slower than the above.
+         double ur = real(*p); 
+         double ui = imag(*p);
+         double u2 = ur * ur + ui * ui;
+         double t = u2 * 0.1;
+         *p *= complex_type(cos(t), sin(t));
+         ++p;
+       }
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "", time, resource);
+
+  return 0;
+}
+
diff --git a/libstdc++-v3/testsuite/performance/27_io/cout_insert_int.cc b/libstdc++-v3/testsuite/performance/27_io/cout_insert_int.cc
new file mode 100644 (file)
index 0000000..87b1871
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <iostream>
+#include <testsuite_performance.h>
+
+// libstdc++/7076
+int main() 
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 150000;
+
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; i++)
+    std::cout << i << '\n';
+  stop_counters(time, resource);
+  report_performance(__FILE__, "", time, resource);
+
+  return 0;
+} 
diff --git a/libstdc++-v3/testsuite/performance/27_io/filebuf_copy.cc b/libstdc++-v3/testsuite/performance/27_io/filebuf_copy.cc
new file mode 100644 (file)
index 0000000..608ca29
--- /dev/null
@@ -0,0 +1,75 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <fstream>
+#include <testsuite_performance.h>
+
+int main()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const unsigned long count = 1ul << 30;
+
+  // C unlocked
+  FILE* fpi = fopen("/dev/zero", "r");
+  FILE* fpo = fopen("/dev/null", "w");
+  start_counters(time, resource);
+  for (unsigned long i = 0; i < count; ++i)
+    {
+      int c = getc_unlocked(fpi);
+      if (c == EOF || putc_unlocked(c, fpo) == EOF)
+       break;
+    }
+  stop_counters(time, resource);
+  fclose(fpi);
+  fclose(fpo);
+  report_performance(__FILE__, "C unlocked", time, resource);
+  clear_counters(time, resource);
+
+  // C++
+  filebuf in;
+  in.open("/dev/zero", ios::in);
+  filebuf out;
+  out.open("/dev/null", ios::out);
+  start_counters(time, resource);
+  for (unsigned long i = 0; i < count; ++i)
+    {
+      int c = in.sbumpc();
+      if (c == EOF || out.sputc(c) == EOF)
+       break;
+    }
+  stop_counters(time, resource);
+  in.close();
+  out.close();
+  report_performance(__FILE__, "C++", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/27_io/filebuf_sputc.cc b/libstdc++-v3/testsuite/performance/27_io/filebuf_sputc.cc
new file mode 100644 (file)
index 0000000..c286da0
--- /dev/null
@@ -0,0 +1,74 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <fstream>
+#include <testsuite_performance.h>
+
+// libstdc++/9876
+int main() 
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 100000000;
+
+  // C
+  FILE* file = fopen("tmp", "w+");
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i)
+    putc(i % 100, file);
+  stop_counters(time, resource);
+  fclose(file);
+  report_performance(__FILE__, "C", time, resource);
+  clear_counters(time, resource);
+
+  // C unlocked
+  file = fopen("tmp", "w+");
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i)
+    putc_unlocked(i % 100, file);
+  stop_counters(time, resource);
+  fclose(file);
+  report_performance(__FILE__, "C unlocked", time, resource);
+  clear_counters(time, resource);
+
+
+  // C++
+  filebuf buf;
+  buf.open("tmp", ios_base::out | ios_base::in | ios_base::trunc);
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i)
+    buf.sputc(i % 100);
+  stop_counters(time, resource);
+  report_performance(__FILE__, "C++", time, resource);
+
+  unlink("tmp");
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/27_io/fstream_seek_write.cc b/libstdc++-v3/testsuite/performance/27_io/fstream_seek_write.cc
new file mode 100644 (file)
index 0000000..838eae4
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <fstream>
+#include <testsuite_performance.h>
+
+// libstdc++/10672
+int main() 
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 300000;
+
+  fstream s("tmp_perf_seek", ios::binary | ios::in | ios::out | ios::trunc);
+  if (s.good())
+    {
+      start_counters(time, resource);
+      for (int i = 0; i < iterations; i++) 
+       {
+         s.seekp(0);
+         s.write((char *) & i, sizeof(int));
+         s.seekp(sizeof(int));
+         s.write((char *) & i, sizeof(int));
+       }
+      stop_counters(time, resource);
+      report_performance(__FILE__, "", time, resource);
+    }
+
+  unlink("tmp_perf_seek");
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/27_io/ifstream_extract_float.cc b/libstdc++-v3/testsuite/performance/27_io/ifstream_extract_float.cc
new file mode 100644 (file)
index 0000000..55710c2
--- /dev/null
@@ -0,0 +1,76 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <fstream>
+#include <sstream>
+#include <testsuite_performance.h>
+
+void test_extraction(int p = 6)
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  const char* filename = "tmp_perf_float.txt";
+  const int iterations = 10000000;
+
+  ostringstream oss;
+  oss << "precision " << p;
+
+  // Construct data.
+  {
+    ofstream out(filename);
+    out.precision(p);
+    for (int i = 0; i < iterations; ++i)
+      {
+       float f = i * 3.14159265358979323846;
+       out << f << '\n';
+      }
+  }
+
+  {
+    time_counter time;
+    resource_counter resource;
+
+    ifstream in(filename);
+    in.precision(p);
+    float f;
+    start_counters(time, resource);  
+    for (int j, i = 0; i < iterations; ++i)
+      in >> f;
+    stop_counters(time, resource);
+    report_performance(__FILE__, oss.str(), time, resource);
+  }
+
+  unlink(filename);
+};
+
+int main()
+{
+  test_extraction(6);
+  test_extraction(12);
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/27_io/ifstream_extract_int.cc b/libstdc++-v3/testsuite/performance/27_io/ifstream_extract_int.cc
new file mode 100644 (file)
index 0000000..b6ff6c4
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <fstream>
+#include <testsuite_performance.h>
+
+int main() 
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 10000000;
+
+  {
+    ofstream out("tmp_perf_int.txt");
+    for (int i = 0; i < iterations; ++i)
+      out << i << "\n";
+  }
+
+  {
+    ifstream in("tmp_perf_int.txt");
+    start_counters(time, resource);  
+    for (int j, i = 0; i < iterations; ++i)
+      in >> j;
+    stop_counters(time, resource);
+    report_performance(__FILE__, "", time, resource);
+  }
+
+  unlink("tmp_perf_int.txt");
+  return 0;
+};
diff --git a/libstdc++-v3/testsuite/performance/27_io/ifstream_getline.cc b/libstdc++-v3/testsuite/performance/27_io/ifstream_getline.cc
new file mode 100644 (file)
index 0000000..5f74573
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <fstream>
+#include <testsuite_performance.h>
+
+// libstdc++/5001 (100,000 line input file)
+int main ()
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+
+  const char* name1 = "/usr/share/dict/words";
+  const char* name2 = "/usr/share/dict/linux.words";
+  ifstream in;
+  in.open(name1);
+  if (!in.is_open())
+    {
+      in.clear();
+      in.open(name2);
+    }
+
+  char buffer[BUFSIZ];
+  start_counters(time, resource);
+  if (in.is_open())
+    {
+      while (in.good()) 
+       in.getline(buffer, BUFSIZ);
+    }
+  stop_counters(time, resource);
+  report_performance(__FILE__, "", time, resource);
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/27_io/ofstream_insert_float.cc b/libstdc++-v3/testsuite/performance/27_io/ofstream_insert_float.cc
new file mode 100644 (file)
index 0000000..45d55af
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <fstream>
+#include <sstream>
+#include <testsuite_performance.h>
+
+// Based on libstdc++/8761 poor fstream performance (converted to float)
+void test_insertion(int p = 6)
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  const char* filename = "tmp_perf_float.txt";
+  const int iterations = 10000000;
+
+  ostringstream oss;
+  oss << "precision " << p;
+
+  {
+    time_counter time;
+    resource_counter resource;
+
+    ofstream out(filename);
+    out.precision(p);
+    start_counters(time, resource);
+    for (int i = 0; i < iterations; ++i)
+      {
+       float f = i * 3.14159265358979323846;
+       out << f << '\n';
+      }
+    stop_counters(time, resource);
+    report_performance(__FILE__, oss.str(), time, resource);
+  }
+
+  unlink(filename);
+};
+
+int main()
+{
+  test_insertion(6);
+  test_insertion(12);
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/27_io/ofstream_insert_int.cc b/libstdc++-v3/testsuite/performance/27_io/ofstream_insert_int.cc
new file mode 100644 (file)
index 0000000..83fbeb8
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (C) 2003 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
+// any later version.
+
+// This library 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 this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <fstream>
+#include <testsuite_performance.h>
+
+// libstdc++/8761 poor fstream performance
+int main() 
+{
+  using namespace std;
+  using namespace __gnu_test;
+
+  time_counter time;
+  resource_counter resource;
+  const int iterations = 10000000;
+
+  ofstream out("tmp_perf_int.txt");
+  start_counters(time, resource);
+  for (int i = 0; i < iterations; ++i)
+    out << i << "\n";
+  stop_counters(time, resource);
+  report_performance(__FILE__, "", time, resource);
+
+  unlink("tmp_perf_int.txt");
+  return 0;
+};
diff --git a/libstdc++-v3/testsuite/performance/allocator.cc b/libstdc++-v3/testsuite/performance/allocator.cc
deleted file mode 100644 (file)
index 5f864ea..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * The goal with this application is to compare the performance
- * between different std::allocator implementations. The results are
- * influenced by the underlying allocator in the "C" library, malloc.
- */
-
-// 2003-02-05 Stefan Olsson <stefan@snon.net>
-
-#include <vector>
-#include <list>
-#include <typeinfo>
-#include <sstream>
-#include <ext/mt_allocator.h>
-#include <ext/new_allocator.h>
-#include <ext/malloc_allocator.h>
-#include <cxxabi.h>
-#include <testsuite_performance.h>
-
-using namespace std;
-using __gnu_cxx::__mt_alloc;
-using __gnu_cxx::new_allocator;
-using __gnu_cxx::malloc_allocator;
-
-typedef int test_type;
-
-// The number of iterations to be performed.
-int iterations = 100000;
-
-// The number of values to insert in the container, 32 will cause 5
-// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
-// This means that all allocations are within _MAX_BYTES = 128 as
-// defined in stl_alloc.h for __pool_alloc.  Whether or not this
-// value is relevant in "the real world" or not I don't know and
-// should probably be investigated in more detail.
-int insert_values = 128;
-
-template<typename Container>
-  int
-  do_loop()
-  {
-    int test_iterations = 0;
-    try
-      {
-       Container obj;
-       while (test_iterations < iterations)
-         {
-           for (int j = 0; j < insert_values; ++j)
-             obj.push_back(test_iterations);
-           ++test_iterations;
-         }
-      }
-    catch(...)
-      {
-       // No point allocating all available memory, repeatedly.        
-      }
-    return test_iterations;
-  }
-
-template<typename Container>
-  void
-  test_container(Container obj)
-  {
-    using namespace __gnu_test;
-    int status;
-
-    time_counter time;
-    resource_counter resource;
-    clear_counters(time, resource);
-    start_counters(time, resource);
-    int test_iterations = do_loop<Container>();
-    stop_counters(time, resource);
-    std::ostringstream comment;
-    comment << "iterations: " << test_iterations << '\t';
-    comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
-                                              0, 0, &status);
-    report_header(__FILE__, comment.str());
-    report_performance(__FILE__, string(), time, resource);
-  }
-
-// http://gcc.gnu.org/ml/libstdc++/2001-05/msg00105.html
-// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
-int main(void)
-{
-#ifdef TEST_B1
-  test_container(vector<test_type>());
-#endif
-#ifdef TEST_B2
-  test_container(vector<test_type, malloc_allocator<test_type> >());
-#endif
-#ifdef TEST_B3
-  test_container(vector<test_type, new_allocator<test_type> >());
-#endif
-#ifdef TEST_B4
-  test_container(vector<test_type, __mt_alloc<test_type> >());
-#endif
-
-#ifdef TEST_B5
-  test_container(list<test_type>());
-#endif
-#ifdef TEST_B6
-  test_container(list<test_type, malloc_allocator<test_type> >());
-#endif
-#ifdef TEST_B7
-  test_container(list<test_type, new_allocator<test_type> >());
-#endif
-#ifdef TEST_B8
-  test_container(list<test_type, __mt_alloc<test_type> >());
-#endif
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/allocator_map_thread.cc b/libstdc++-v3/testsuite/performance/allocator_map_thread.cc
deleted file mode 100644 (file)
index f6b4d45..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * The goal with this application is to compare the performance
- * between different std::allocator implementations. The results are
- * influenced by the underlying allocator in the "C" library, malloc.
- */
-
-// libstdc++/13823 recast for this testing framework
-
-#include <map>
-#include <iostream>
-#include <typeinfo>
-#include <sstream>
-#include <ext/mt_allocator.h>
-#include <ext/new_allocator.h>
-#include <ext/malloc_allocator.h>
-#include <cxxabi.h>
-#include <testsuite_performance.h>
-
-using namespace std;
-using __gnu_cxx::__mt_alloc;
-using __gnu_cxx::new_allocator;
-using __gnu_cxx::malloc_allocator;
-
-// The number of iterations to be performed.
-int iterations = 25000;
-
-template<typename Container>
-  void*
-  do_loop(void* p = NULL)
-  {
-    try
-      {
-       for (int c = 0; c < 10; c++)
-         {
-           Container m;
-
-           for (unsigned i = 0; i < iterations; ++i) 
-             m[i] = i;
-         }
-      }
-    catch(...)
-      {
-       // No point allocating all available memory, repeatedly.        
-      }
-  }
-
-template<typename Container>
-  void
-  test_container(Container obj)
-  {
-    using namespace __gnu_test;
-    int status;
-
-    time_counter time;
-    resource_counter resource;
-
-    clear_counters(time, resource);
-    start_counters(time, resource);
-    
-    pthread_t  t1, t2, t3, t4;
-    pthread_create(&t1, NULL, &do_loop<Container>, NULL);
-    pthread_create(&t2, NULL, &do_loop<Container>, NULL);
-    pthread_create(&t3, NULL, &do_loop<Container>, NULL);
-    pthread_create(&t4, NULL, &do_loop<Container>, NULL);
-
-    pthread_join(t1, NULL);
-    pthread_join(t2, NULL);
-    pthread_join(t3, NULL);
-    pthread_join(t4, NULL);
-
-    stop_counters(time, resource);
-    std::ostringstream comment;
-    comment << "iterations: " << iterations << '\t';
-    comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
-                                              0, 0, &status);
-    report_header(__FILE__, comment.str());
-    report_performance(__FILE__, string(), time, resource);
-  }
-
-int main(void)
-{
-#ifdef TEST_T1
-  test_container(map<int, int>());
-#endif
-#ifdef TEST_T2
-  test_container(map<int, int, less<const int>, new_allocator<int> >());
-#endif
-#ifdef TEST_T3
-  test_container(map<int, int, less<const int>, malloc_allocator<int> >());
-#endif
-#ifdef TEST_T4
-  test_container(map<int, int, less<const int>,
-                     __mt_alloc< pair<const int, int> > >());
-#endif
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/allocator_thread.cc b/libstdc++-v3/testsuite/performance/allocator_thread.cc
deleted file mode 100644 (file)
index b313a1f..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- * The goal with this application is to compare the performance
- * between different std::allocator implementations. The results are
- * influenced by the underlying allocator in the "C" library, malloc.
- */
-
-// 2003-02-05 Stefan Olsson <stefan@snon.net>
-
-#include <vector>
-#include <list>
-#include <typeinfo>
-#include <sstream>
-#include <pthread.h>
-#include <ext/mt_allocator.h>
-#include <ext/new_allocator.h>
-#include <ext/malloc_allocator.h>
-#include <cxxabi.h>
-#include <testsuite_performance.h>
-
-using namespace std;
-using __gnu_cxx::__mt_alloc;
-using __gnu_cxx::new_allocator;
-using __gnu_cxx::malloc_allocator;
-
-typedef int test_type;
-
-// The number of iterations to be performed.
-int iterations = 25000;
-
-// The number of values to insert in the container, 32 will cause 5
-// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
-// This means that all allocations are within _MAX_BYTES = 128 as
-// defined in stl_alloc.h for __pool_alloc.  Whether or not this
-// value is relevant in "the real world" or not I don't know and
-// should probably be investigated in more detail.
-int insert_values = 128;
-
-template<typename Container>
-  void*
-  do_loop(void* p = NULL)
-  {
-    Container obj;    
-    try
-      {
-       int test_iterations = 0;
-       while (test_iterations < iterations)
-         {
-           for (int j = 0; j < insert_values; ++j)
-             obj.push_back(test_iterations);
-           ++test_iterations;
-         }
-       obj.clear();
-       test_iterations = 0;
-       while (test_iterations < iterations)
-         {
-           for (int j = 0; j < insert_values; ++j)
-             obj.push_back(test_iterations);
-           ++test_iterations;
-         }
-      }
-    catch(...)
-      {
-       // No point allocating all available memory, repeatedly.        
-      }
-  }
-
-template<typename Container>
-  void
-  test_container(Container obj)
-  {
-    using namespace __gnu_test;
-    int status;
-
-    time_counter time;
-    resource_counter resource;
-
-    clear_counters(time, resource);
-    start_counters(time, resource);
-    
-    pthread_t  t1, t2, t3, t4;
-    pthread_create(&t1, 0, &do_loop<Container>, 0);
-    pthread_create(&t2, 0, &do_loop<Container>, 0);
-    pthread_create(&t3, 0, &do_loop<Container>, 0);
-    pthread_create(&t4, 0, &do_loop<Container>, 0);
-
-    pthread_join(t1, NULL);
-    pthread_join(t2, NULL);
-    pthread_join(t3, NULL);
-    pthread_join(t4, NULL);
-
-    stop_counters(time, resource);
-    std::ostringstream comment;
-    comment << "iterations: " << iterations << '\t';
-    comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
-                                              0, 0, &status);
-    report_header(__FILE__, comment.str());
-    report_performance(__FILE__, string(), time, resource);
-  }
-
-// http://gcc.gnu.org/ml/libstdc++/2001-05/msg00105.html
-// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
-int main(void)
-{
-#ifdef TEST_T1
-  test_container(vector<test_type>());
-#endif
-#ifdef TEST_T2
-  test_container(vector<test_type, malloc_allocator<test_type> >());
-#endif
-#ifdef TEST_T3
-  test_container(vector<test_type, new_allocator<test_type> >());
-#endif
-#ifdef TEST_T4
-  test_container(vector<test_type, __mt_alloc<test_type> >());
-#endif
-
-#ifdef TEST_T5
-  test_container(list<test_type>());
-#endif
-#ifdef TEST_T6
-  test_container(list<test_type, malloc_allocator<test_type> >());
-#endif
-#ifdef TEST_T7
-  test_container(list<test_type, new_allocator<test_type> >());
-#endif
-#ifdef TEST_T8
-  test_container(list<test_type, __mt_alloc<test_type> >());
-#endif
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/complex_norm.cc b/libstdc++-v3/testsuite/performance/complex_norm.cc
deleted file mode 100644 (file)
index 6ed280c..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <complex>
-#include <testsuite_performance.h>
-
-// based on libstdc++/5730, use --fast-math
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 2000;
-
-  typedef complex<double> complex_type;
-  complex_type u[2048];
-
-  for (int i = 0; i < 2048; ++i)
-    u[i] = 1.0;
-
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i) 
-    {
-      complex_type * p = u;
-      for (int j = 0; j < 2048; ++j) 
-       {
-         double u2 = norm(*p);
-         double t = u2 * 0.1;
-         *p *= complex_type(cos(t), sin(t));
-         ++p;
-       }
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "norm", time, resource);
-  clear_counters(time, resource);
-
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i) 
-    {
-      complex_type * p = u;
-      for (int j = 0; j < 2048; ++j) 
-       {
-         // Shouldn't be slower than the above.
-         double ur = real(*p); 
-         double ui = imag(*p);
-         double u2 = ur * ur + ui * ui;
-         double t = u2 * 0.1;
-         *p *= complex_type(cos(t), sin(t));
-         ++p;
-       }
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "", time, resource);
-
-  return 0;
-}
-
diff --git a/libstdc++-v3/testsuite/performance/container_benchmark.cc b/libstdc++-v3/testsuite/performance/container_benchmark.cc
deleted file mode 100644 (file)
index 4e54374..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cmath>
-#include <cstdlib>
-
-#include <vector>
-#include <algorithm>
-#include <list>
-#include <deque>
-#include <set>
-
-#include <sstream>
-#include <testsuite_performance.h>
-
-using namespace std;
-
-typedef double element_t;
-typedef void(*test)(element_t*, element_t*);
-
-void array_test(element_t* first, element_t* last)
-{
-  element_t* array = new element_t[last - first];
-  copy(first, last, array);
-  sort(array, array + (last - first));
-  unique(array, array + (last - first));
-  delete [] array;       
-}
-
-void vector_pointer_test(element_t* first, element_t* last)
-{ 
-  vector<element_t> container(first, last);
-  sort(&*container.begin(), &*container.end());
-  unique(&*container.begin(), &*container.end());
-}
-
-void vector_iterator_test(element_t* first, element_t* last)
-{
-  vector<element_t> container(first, last);
-  sort(container.begin(), container.end());
-  unique(container.begin(), container.end());
-}
-
-void deque_test(element_t* first, element_t* last)
-{  
-  deque<element_t> container(first, last);
-  copy(first, last, container.begin()); 
-  sort(container.begin(), container.end());
-  unique(container.begin(), container.end());
-}
-    
-void list_test(element_t* first, element_t* last)
-{ 
-  list<element_t> container(first, last);
-  container.sort();
-  container.unique();
-}
-void set_test(element_t* first, element_t* last)
-{ set<element_t> container(first, last); }
-
-void multiset_test(element_t* first, element_t* last)
-{
-  multiset<element_t> container(first, last);
-  typedef multiset<element_t>::iterator iterator;
-  {
-    iterator first = container.begin();
-    iterator last = container.end();
-    
-    while (first != last)
-      {
-       iterator next = first;
-       if (++next == last) break;
-       if (*first == *next)
-         container.erase(next);
-       else
-         ++first;
-      }
-  }
-}
-
-double logtwo(double x)
-{ return log(x)/log(2.0); }
-
-int number_of_tests(int size)
-{
-  const double n = size;
-  const double largest_n = 1000000;
-  return int(floor((largest_n * logtwo(largest_n))
-                  / (n * logtwo(n))));
-}
-
-void initialize(element_t* first, element_t* last)
-{
-  element_t value = 0.0;
-  while (first != last)
-    {
-      *first++ = value;
-      value += 1.;
-    }
-}
-
-void run_tests(int size, const test* tests, const char** names,
-              int ntests)
-{
-  using namespace __gnu_test;
-  time_counter time;
-  resource_counter resource;
-
-  const int n = number_of_tests(size);
-  const size_t length = 2 * size;
-
-  // make a random test set of the chosen size:
-  vector<element_t> buf(length);
-  element_t* buffer = &buf[0];
-  element_t* buffer_end = &buf[length];
-  initialize(buffer, buffer + size);    // elements
-  initialize(buffer + size, buffer_end); // duplicate elements
-  random_shuffle(buffer, buffer_end);
-
-  // test the containers:
-  ostringstream oss;
-  oss << "size = " << size << " :";
-  report_header(__FILE__, oss.str());
-  for (int i = 0; i < ntests; ++i)
-    {
-      start_counters(time, resource);
-      for (int j = 0; j < n; ++j)
-       tests[i](buffer, buffer_end);
-      stop_counters(time, resource);
-      report_performance(__FILE__, names[i], time, resource);
-      clear_counters(time, resource);
-    }
-}
-
-int main()
-{
-  const test tests[] = { &array_test, &vector_pointer_test,
-                        &vector_iterator_test, &deque_test,
-                        &list_test, &set_test, &multiset_test };
-  const int ntests = sizeof(tests) / sizeof(test);
-  const char* names[ntests] = { "array", "vector (pointer)",
-                               "vector (iterator)", "deque",
-                               "list", "set", "multiset" };
-
-  const int sizes[] = {100, 1000, 10000, 100000};
-  for (int i = 0; i < sizeof(sizes) / sizeof(int); ++i)
-    run_tests(sizes[i], tests, names, ntests);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/cout_insert_int.cc b/libstdc++-v3/testsuite/performance/cout_insert_int.cc
deleted file mode 100644 (file)
index 87b1871..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <iostream>
-#include <testsuite_performance.h>
-
-// libstdc++/7076
-int main() 
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 150000;
-
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; i++)
-    std::cout << i << '\n';
-  stop_counters(time, resource);
-  report_performance(__FILE__, "", time, resource);
-
-  return 0;
-} 
diff --git a/libstdc++-v3/testsuite/performance/filebuf_copy.cc b/libstdc++-v3/testsuite/performance/filebuf_copy.cc
deleted file mode 100644 (file)
index 608ca29..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cstdio>
-#include <fstream>
-#include <testsuite_performance.h>
-
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const unsigned long count = 1ul << 30;
-
-  // C unlocked
-  FILE* fpi = fopen("/dev/zero", "r");
-  FILE* fpo = fopen("/dev/null", "w");
-  start_counters(time, resource);
-  for (unsigned long i = 0; i < count; ++i)
-    {
-      int c = getc_unlocked(fpi);
-      if (c == EOF || putc_unlocked(c, fpo) == EOF)
-       break;
-    }
-  stop_counters(time, resource);
-  fclose(fpi);
-  fclose(fpo);
-  report_performance(__FILE__, "C unlocked", time, resource);
-  clear_counters(time, resource);
-
-  // C++
-  filebuf in;
-  in.open("/dev/zero", ios::in);
-  filebuf out;
-  out.open("/dev/null", ios::out);
-  start_counters(time, resource);
-  for (unsigned long i = 0; i < count; ++i)
-    {
-      int c = in.sbumpc();
-      if (c == EOF || out.sputc(c) == EOF)
-       break;
-    }
-  stop_counters(time, resource);
-  in.close();
-  out.close();
-  report_performance(__FILE__, "C++", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/filebuf_sputc.cc b/libstdc++-v3/testsuite/performance/filebuf_sputc.cc
deleted file mode 100644 (file)
index c286da0..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cstdio>
-#include <fstream>
-#include <testsuite_performance.h>
-
-// libstdc++/9876
-int main() 
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 100000000;
-
-  // C
-  FILE* file = fopen("tmp", "w+");
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i)
-    putc(i % 100, file);
-  stop_counters(time, resource);
-  fclose(file);
-  report_performance(__FILE__, "C", time, resource);
-  clear_counters(time, resource);
-
-  // C unlocked
-  file = fopen("tmp", "w+");
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i)
-    putc_unlocked(i % 100, file);
-  stop_counters(time, resource);
-  fclose(file);
-  report_performance(__FILE__, "C unlocked", time, resource);
-  clear_counters(time, resource);
-
-
-  // C++
-  filebuf buf;
-  buf.open("tmp", ios_base::out | ios_base::in | ios_base::trunc);
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i)
-    buf.sputc(i % 100);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "C++", time, resource);
-
-  unlink("tmp");
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/fstream_seek_write.cc b/libstdc++-v3/testsuite/performance/fstream_seek_write.cc
deleted file mode 100644 (file)
index 838eae4..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <fstream>
-#include <testsuite_performance.h>
-
-// libstdc++/10672
-int main() 
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 300000;
-
-  fstream s("tmp_perf_seek", ios::binary | ios::in | ios::out | ios::trunc);
-  if (s.good())
-    {
-      start_counters(time, resource);
-      for (int i = 0; i < iterations; i++) 
-       {
-         s.seekp(0);
-         s.write((char *) & i, sizeof(int));
-         s.seekp(sizeof(int));
-         s.write((char *) & i, sizeof(int));
-       }
-      stop_counters(time, resource);
-      report_performance(__FILE__, "", time, resource);
-    }
-
-  unlink("tmp_perf_seek");
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/ifstream_extract_float.cc b/libstdc++-v3/testsuite/performance/ifstream_extract_float.cc
deleted file mode 100644 (file)
index 55710c2..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (C) 2004 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <fstream>
-#include <sstream>
-#include <testsuite_performance.h>
-
-void test_extraction(int p = 6)
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  const char* filename = "tmp_perf_float.txt";
-  const int iterations = 10000000;
-
-  ostringstream oss;
-  oss << "precision " << p;
-
-  // Construct data.
-  {
-    ofstream out(filename);
-    out.precision(p);
-    for (int i = 0; i < iterations; ++i)
-      {
-       float f = i * 3.14159265358979323846;
-       out << f << '\n';
-      }
-  }
-
-  {
-    time_counter time;
-    resource_counter resource;
-
-    ifstream in(filename);
-    in.precision(p);
-    float f;
-    start_counters(time, resource);  
-    for (int j, i = 0; i < iterations; ++i)
-      in >> f;
-    stop_counters(time, resource);
-    report_performance(__FILE__, oss.str(), time, resource);
-  }
-
-  unlink(filename);
-};
-
-int main()
-{
-  test_extraction(6);
-  test_extraction(12);
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/ifstream_extract_int.cc b/libstdc++-v3/testsuite/performance/ifstream_extract_int.cc
deleted file mode 100644 (file)
index b6ff6c4..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <fstream>
-#include <testsuite_performance.h>
-
-int main() 
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 10000000;
-
-  {
-    ofstream out("tmp_perf_int.txt");
-    for (int i = 0; i < iterations; ++i)
-      out << i << "\n";
-  }
-
-  {
-    ifstream in("tmp_perf_int.txt");
-    start_counters(time, resource);  
-    for (int j, i = 0; i < iterations; ++i)
-      in >> j;
-    stop_counters(time, resource);
-    report_performance(__FILE__, "", time, resource);
-  }
-
-  unlink("tmp_perf_int.txt");
-  return 0;
-};
diff --git a/libstdc++-v3/testsuite/performance/ifstream_getline.cc b/libstdc++-v3/testsuite/performance/ifstream_getline.cc
deleted file mode 100644 (file)
index 5f74573..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <fstream>
-#include <testsuite_performance.h>
-
-// libstdc++/5001 (100,000 line input file)
-int main ()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-
-  const char* name1 = "/usr/share/dict/words";
-  const char* name2 = "/usr/share/dict/linux.words";
-  ifstream in;
-  in.open(name1);
-  if (!in.is_open())
-    {
-      in.clear();
-      in.open(name2);
-    }
-
-  char buffer[BUFSIZ];
-  start_counters(time, resource);
-  if (in.is_open())
-    {
-      while (in.good()) 
-       in.getline(buffer, BUFSIZ);
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/is_wchar_t.cc b/libstdc++-v3/testsuite/performance/is_wchar_t.cc
deleted file mode 100644 (file)
index e35edd0..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <locale>
-#include <cwctype>
-#include <cstddef>
-#include <testsuite_performance.h>
-
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const wchar_t str[] =
-    L"Is this the real life?\n"
-    L"Is this just fantasy?\n"
-    L"Caught in a landslide\n"
-    L"No escape from reality\n"
-    L"Open your eyes\n"
-    L"Look up to the skies and see\n"
-    L"I'm just a poor boy\n"
-    L"I need no sympathy\n"
-    L"Because I'm easy come, easy go\n"
-    L"Little high, little low"
-    L"Anyway the wind blows\n"
-    L"Doesn't really matter to me\n"
-    L"To me\n"
-    L"                      -- Queen\n";
-  const size_t len = sizeof(str) / sizeof(str[0]) - 1;
-
-  locale loc;
-  const ctype<wchar_t>& ct = use_facet<ctype<wchar_t> >(loc);
-
-  // C
-  wctype_t w = wctype("space");
-  start_counters(time, resource);
-  for (int j = 0; j < 200000; ++j)
-    {
-      for (size_t i = 0; i < len; ++i)
-       {
-         iswctype(str[i], w);
-       }
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "C", time, resource);
-  clear_counters(time, resource);
-
-  // C++
-  start_counters(time, resource);
-  for (int j = 0; j < 200000; ++j)
-    {
-      for (size_t i = 0; i < len; ++i)
-       {
-         ct.is(ctype_base::space, str[i]);
-       }
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "C++", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/list_create_fill_sort.cc b/libstdc++-v3/testsuite/performance/list_create_fill_sort.cc
deleted file mode 100644 (file)
index 8999b43..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// 2003-07-07 gp dot bolton at computer dot org
-
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <list>
-#include <testsuite_hooks.h>
-#include <testsuite_performance.h>
-
-
-static void create_and_fill_and_sort(const unsigned int n)
-{
-  typedef std::list<int>  List;
-  List                    l;
-  
-  for (unsigned int i = 0; i < n; ++i)
-  {
-      l.push_back(n - i);
-  }
-  l.sort();
-}
-
-
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  char comment[80];
-
-  for (unsigned int n = 1; n <= 1000; n *= 10)
-  {
-      const unsigned int iterations = 10000000/n;
-
-      start_counters(time, resource);
-
-      for (unsigned int i = 0; i < iterations; ++i)
-      {
-         create_and_fill_and_sort( n );
-      }
-      stop_counters(time, resource);
-
-      sprintf(comment,"Iters: %8u  Size: %4u", iterations, n);
-      report_performance(__FILE__, comment, time, resource);
-  }
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/map_create_fill.cc b/libstdc++-v3/testsuite/performance/map_create_fill.cc
deleted file mode 100644 (file)
index 0e675d0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// 2003-03-01 gp dot bolton at computer dot org
-
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-#include <map>
-#include <testsuite_hooks.h>
-#include <testsuite_performance.h>
-
-static void create_and_fill(const unsigned int n)
-{
-  typedef std::map<int, int>  Map;
-  Map                         m;
-  bool test __attribute__((unused)) = true;
-  
-  for (unsigned int i = 0; i < n; ++i)
-    m[i] = i;
-  VERIFY( m.size() == n );
-}
-
-// http://gcc.gnu.org/ml/libstdc++/2003-03/msg00000.html
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 100000000;
-  
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i)
-    create_and_fill( 0 );
-  stop_counters(time, resource);
-  report_performance(__FILE__, "", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/narrow_widen_char.cc b/libstdc++-v3/testsuite/performance/narrow_widen_char.cc
deleted file mode 100644 (file)
index f8b530d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <locale>
-#include <testsuite_performance.h>
-
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  char bufin[] = "This was an attempt to bypass string construction just for test.";
-  char bufout[sizeof(bufin)];
-
-  locale loc;
-  const ctype<char>& ct = use_facet<ctype<char> >(loc);
-
-  // narrow
-  start_counters(time, resource);
-  for (long i = 0; i < 1000000000; ++i)
-    ct.narrow(i % 128, '*');
-  stop_counters(time, resource);
-  report_performance(__FILE__, "narrow", time, resource);
-  clear_counters(time, resource);
-
-  // narrow array
-  start_counters(time, resource);
-  for (long i = 0; i < 100000000; ++i)
-    ct.narrow(bufin, bufin+sizeof(bufin), '*', bufout);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "narrow_array", time, resource);
-  clear_counters(time, resource);
-
-  // widen
-  start_counters(time, resource);
-  for (long i = 0; i < 1000000000; ++i)
-    ct.widen(i % 128);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "widen", time, resource);
-  clear_counters(time, resource);
-
-  // widen array
-  start_counters(time, resource);
-  for (long i = 0; i < 100000000; ++i)
-    ct.widen(bufin, bufin+sizeof(bufin), bufout);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "widen_array", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/narrow_widen_wchar_t.cc b/libstdc++-v3/testsuite/performance/narrow_widen_wchar_t.cc
deleted file mode 100644 (file)
index f5d4536..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <locale>
-#include <testsuite_performance.h>
-
-int main()
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  wchar_t bufwc[] = L"Mi innamoravo di tutto (Fabrizio De Andre')";
-  char bufc[sizeof(bufwc) / sizeof(wchar_t)];
-
-  locale loc;
-  const ctype<wchar_t>& ct = use_facet<ctype<wchar_t> >(loc);
-
-  // narrow
-  start_counters(time, resource);
-  for (long i = 0; i < 200000000; ++i)
-    ct.narrow(i % 128, '*');
-  stop_counters(time, resource);
-  report_performance(__FILE__, "narrow", time, resource);
-  clear_counters(time, resource);
-
-  // narrow array
-  start_counters(time, resource);
-  for (long i = 0; i < 20000000; ++i)
-    ct.narrow(bufwc, bufwc + sizeof(bufwc) / sizeof(wchar_t), '*', bufc);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "narrow array", time, resource);
-  clear_counters(time, resource);
-
-  // widen
-  start_counters(time, resource);
-  for (long i = 0; i < 200000000; ++i)
-    ct.widen(i % 128);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "widen", time, resource);
-  clear_counters(time, resource);
-
-  // widen array
-  start_counters(time, resource);
-  for (long i = 0; i < 20000000; ++i)
-    ct.widen(bufc, bufc + sizeof(bufc), bufwc);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "widen array", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/ofstream_insert_float.cc b/libstdc++-v3/testsuite/performance/ofstream_insert_float.cc
deleted file mode 100644 (file)
index 45d55af..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <fstream>
-#include <sstream>
-#include <testsuite_performance.h>
-
-// Based on libstdc++/8761 poor fstream performance (converted to float)
-void test_insertion(int p = 6)
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  const char* filename = "tmp_perf_float.txt";
-  const int iterations = 10000000;
-
-  ostringstream oss;
-  oss << "precision " << p;
-
-  {
-    time_counter time;
-    resource_counter resource;
-
-    ofstream out(filename);
-    out.precision(p);
-    start_counters(time, resource);
-    for (int i = 0; i < iterations; ++i)
-      {
-       float f = i * 3.14159265358979323846;
-       out << f << '\n';
-      }
-    stop_counters(time, resource);
-    report_performance(__FILE__, oss.str(), time, resource);
-  }
-
-  unlink(filename);
-};
-
-int main()
-{
-  test_insertion(6);
-  test_insertion(12);
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/ofstream_insert_int.cc b/libstdc++-v3/testsuite/performance/ofstream_insert_int.cc
deleted file mode 100644 (file)
index 83fbeb8..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <fstream>
-#include <testsuite_performance.h>
-
-// libstdc++/8761 poor fstream performance
-int main() 
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iterations = 10000000;
-
-  ofstream out("tmp_perf_int.txt");
-  start_counters(time, resource);
-  for (int i = 0; i < iterations; ++i)
-    out << i << "\n";
-  stop_counters(time, resource);
-  report_performance(__FILE__, "", time, resource);
-
-  unlink("tmp_perf_int.txt");
-  return 0;
-};
diff --git a/libstdc++-v3/testsuite/performance/string_append.cc b/libstdc++-v3/testsuite/performance/string_append.cc
deleted file mode 100644 (file)
index fccd82c..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
- // Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <ctime>
-#include <iostream>
-#include <string>
-#include <testsuite_performance.h>
-
-using namespace std;
-
-void
-test_append_char(int how_much)
-{
-  string buf; // no preallocation
-  for (int i = 0; i < how_much; ++i)
-    buf.append(static_cast<string::size_type>(1) , 'x');
-}
-
-void
-test_append_string(int how_much)
-{
-  string s(static_cast<string::size_type>(1) , 'x');
-  string buf; // no preallocation
-  for (int i = 0; i < how_much; ++i)
-    buf.append(s);
-}
-
-void 
-run_benchmark1(int how_much)
-{
-  using namespace __gnu_test;
-  time_counter time;
-  resource_counter resource;
-  start_counters(time, resource);
-  test_append_char(how_much);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "char", time, resource);
-}
-
-void 
-run_benchmark2(int how_much)
-{
-  using namespace __gnu_test;
-  time_counter time;
-  resource_counter resource;
-  start_counters(time, resource);
-  test_append_string(how_much);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "string", time, resource);
-}
-
-// libstdc++/5380
-// libstdc++/4960
-int main()
-{
-  run_benchmark1(100000);
-  run_benchmark2(100000);
-  run_benchmark1(1000000);
-  run_benchmark2(1000000);
-  run_benchmark1(10000000);
-  run_benchmark2(10000000);
-}
diff --git a/libstdc++-v3/testsuite/performance/wchar_t_in.cc b/libstdc++-v3/testsuite/performance/wchar_t_in.cc
deleted file mode 100644 (file)
index 43e09e3..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cstdio>
-#include <cstring>
-#include <fstream>
-#include <langinfo.h>
-#include <iconv.h>
-#include <testsuite_performance.h>
-
-// libstdc++/11602 (do_in)
-int main(int argc, char** argv)
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iters = 400000;
-
-  wchar_t wbuf[1024];
-  char cbuf[1024];
-  
-  memset(cbuf, 'a', 1024);
-
-  // C (iconv)
-  iconv_t cd = iconv_open("WCHAR_T", nl_langinfo(CODESET));
-  start_counters(time, resource);
-  for (int i = 0; i < iters; ++i)
-    {
-      size_t inbytesleft = 1024;
-      size_t outbytesleft = 1024 * sizeof(wchar_t);
-      char* in = cbuf;
-      char* out = reinterpret_cast<char*>(wbuf);
-      iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
-    }
-  stop_counters(time, resource);
-  iconv_close(cd);
-  report_performance(__FILE__, "C (iconv)", time, resource);
-  clear_counters(time, resource);
-
-  // C++ (codecvt)
-  locale loc;
-  const codecvt<wchar_t, char, mbstate_t>& cvt =
-    use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
-  mbstate_t state;
-  memset(&state, 0, sizeof(state));
-  start_counters(time, resource);
-  for (int i = 0; i < iters; ++i)
-    {
-      const char* from_next;
-      wchar_t* to_next;
-      cvt.in(state, cbuf, cbuf + 1024, from_next,
-            wbuf, wbuf + 1024, to_next);
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "C++ (codecvt)", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/wchar_t_length.cc b/libstdc++-v3/testsuite/performance/wchar_t_length.cc
deleted file mode 100644 (file)
index f0146fe..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cstdio>
-#include <cstring>
-#include <fstream>
-#include <langinfo.h>
-#include <iconv.h>
-#include <testsuite_performance.h>
-
-// libstdc++/11602 (do_length)
-int main(int argc, char** argv)
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iters = 400000;
-
-  char cbuf[1024];
-  
-  memset(cbuf, 'a', 1024);
-
-  // C++ (codecvt)
-  locale loc;
-  const codecvt<wchar_t, char, mbstate_t>& cvt =
-    use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
-  mbstate_t state;
-  memset(&state, 0, sizeof(state));
-  start_counters(time, resource);
-  for (int i = 0; i < iters; ++i)
-    cvt.length(state, cbuf, cbuf + 1024, 1024);
-  stop_counters(time, resource);
-  report_performance(__FILE__, "C++ (codecvt)", time, resource);
-
-  return 0;
-}
diff --git a/libstdc++-v3/testsuite/performance/wchar_t_out.cc b/libstdc++-v3/testsuite/performance/wchar_t_out.cc
deleted file mode 100644 (file)
index 4e51068..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) 2003 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library.  This library 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 2, or (at your option)
-// any later version.
-
-// This library 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 this library; see the file COPYING.  If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-#include <cstdio>
-#include <cstring>
-#include <fstream>
-#include <langinfo.h>
-#include <iconv.h>
-#include <testsuite_performance.h>
-
-// libstdc++/11602
-int main(int argc, char** argv)
-{
-  using namespace std;
-  using namespace __gnu_test;
-
-  time_counter time;
-  resource_counter resource;
-  const int iters = 300000;
-
-  wchar_t wbuf[1024];
-  char cbuf[1024];
-  
-  wmemset(wbuf, L'a', 1024);
-
-  // C (iconv)
-  iconv_t cd = iconv_open(nl_langinfo(CODESET), "WCHAR_T");
-  start_counters(time, resource);
-  for (int i = 0; i < iters; ++i)
-    {
-      size_t inbytesleft = 1024 * sizeof(wchar_t);
-      size_t outbytesleft = 1024;
-      char* in = reinterpret_cast<char*>(wbuf);
-      char* out = cbuf;
-      iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
-    }
-  stop_counters(time, resource);
-  iconv_close(cd);
-  report_performance(__FILE__, "C (iconv)", time, resource);
-  clear_counters(time, resource);
-
-  // C++ (codecvt)
-  locale loc;
-  const codecvt<wchar_t, char, mbstate_t>& cvt =
-    use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
-  mbstate_t state;
-  memset(&state, 0, sizeof(state));
-  start_counters(time, resource);
-  for (int i = 0; i < iters; ++i)
-    {
-      const wchar_t* from_next;
-      char* to_next;
-      cvt.out(state, wbuf, wbuf + 1024, from_next,
-             cbuf, cbuf + 1024, to_next);
-    }
-  stop_counters(time, resource);
-  report_performance(__FILE__, "C++ (codecvt)", time, resource);
-
-  return 0;
-}