summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/performance
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2013-10-26 16:09:28 +0000
committerTim Shen <timshen@gcc.gnu.org>2013-10-26 16:09:28 +0000
commit9f0d9611e7e420aa97837774053b0c8a11d0bfd7 (patch)
treeed9926c18c61592e28734e2226b4d5ab7fb3fcf0 /libstdc++-v3/testsuite/performance
parent5d905bb6131f34cc21461c111e1afc95fb85b7eb (diff)
downloadgcc-9f0d9611e7e420aa97837774053b0c8a11d0bfd7.tar.gz
regex.h: Remove unnecessary friends.
2013-10-26 Tim Shen <timshen91@gmail.com> * include/bits/regex.h: Remove unnecessary friends. * include/bits/regex.tcc (__regex_algo_impl<>): Move __get_executor to here. * include/bits/regex_executor.h: Remove _DFSExecutor and _BFSExecutor; they are merged into _Executor. Eliminate quantifier tracking part, so it's faster. * include/bits/regex_executor.tcc: Implement _Executor. * testsuite/28_regex/algorithms/regex_match/ecma/char/ungreedy.cc: New. * testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc: Adjust duplicate testcases. * testsuite/performance/28_regex/split.h: New. * testsuite/performance/28_regex/split_bfs.cc: New. * testsuite/util/testsuite_regex.h: Adjust behavior of two-executors agreement judger: do not compare match_results when executor return false. From-SVN: r204093
Diffstat (limited to 'libstdc++-v3/testsuite/performance')
-rw-r--r--libstdc++-v3/testsuite/performance/28_regex/split.cc72
-rw-r--r--libstdc++-v3/testsuite/performance/28_regex/split.h91
-rw-r--r--libstdc++-v3/testsuite/performance/28_regex/split_bfs.cc46
3 files changed, 138 insertions, 71 deletions
diff --git a/libstdc++-v3/testsuite/performance/28_regex/split.cc b/libstdc++-v3/testsuite/performance/28_regex/split.cc
index 5b972e43696..e94e0318c32 100644
--- a/libstdc++-v3/testsuite/performance/28_regex/split.cc
+++ b/libstdc++-v3/testsuite/performance/28_regex/split.cc
@@ -18,82 +18,12 @@
// 2013-10-08 Tim Shen <timshen91@gmail.com>
#include <testsuite_performance.h>
-#include <regex>
+#include "split.h"
using namespace __gnu_test;
-using namespace std;
-
-void split(string s)
-{
- regex re("\\s+");
- for (auto it = sregex_token_iterator(s.begin(), s.end(), re, -1);
- it != sregex_token_iterator();
- ++it)
- {
- }
-}
int main()
{
- string source = "\
-// Copyright (C) 2013 Free Software Foundation, Inc.\n\
-//\n\
-// This file is part of the GNU ISO C++ Library. This library is free\n\
-// software; you can redistribute it and/or modify it under the\n\
-// terms of the GNU General Public License as published by the\n\
-// Free Software Foundation; either version 3, or (at your option)\n\
-// any later version.\n\
-\n\
-// This library is distributed in the hope that it will be useful,\n\
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
-// GNU General Public License for more details.\n\
-\n\
-// You should have received a copy of the GNU General Public License along\n\
-// with this library; see the file COPYING3. If not see\n\
-// <http://www.gnu.org/licenses/>.\n\
-\n\
-// 2013-10-08 Tim Shen <timshen91@gmail.com>\n\
-\n\
-#include <testsuite_performance.h>\n\
-#include <regex>\n\
-\n\
-using namespace __gnu_test;\n\
-using namespace std;\n\
-\n\
-void split(string s)\n\
-{\n\
- regex re(\"\\s+\");\n\
- for (auto it = sregex_token_iterator(s.begin(), s.end(), re, -1);\n\
- it != sregex_token_iterator();\n\
- ++it)\n\
- {\n\
- }\n\
-}\n\
-\n\
-int main()\n\
-{\n\
- string source = \"\";\n\
- time_counter time;\n\
- resource_counter resource;\n\
-\n\
- source = source + source;\n\
- source = source + source;\n\
- source = source + source;\n\
- source = source + source;\n\
- source = source + source;\n\
- source = source + source;\n\
- source = source + source;\n\
- source = source + source;\n\
-\n\
- start_counters(time, resource);\n\
- split(source);\n\
- stop_counters(time, resource);\n\
- report_performance(__FILE__, \"\", time, resource);\n\
-\n\
- return 0;\n\
-}\n";
-
time_counter time;
resource_counter resource;
diff --git a/libstdc++-v3/testsuite/performance/28_regex/split.h b/libstdc++-v3/testsuite/performance/28_regex/split.h
new file mode 100644
index 00000000000..d016d9208bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/28_regex/split.h
@@ -0,0 +1,91 @@
+// Copyright (C) 2013 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 2013-10-26 Tim Shen <timshen91@gmail.com>
+
+#include <regex>
+
+using namespace std;
+
+void split(string s)
+{
+ regex re("\\s+");
+ for (auto it = sregex_token_iterator(s.begin(), s.end(), re, -1);
+ it != sregex_token_iterator();
+ ++it)
+ {
+ }
+}
+
+string source = "\
+// Copyright (C) 2013 Free Software Foundation, Inc.\n\
+//\n\
+// This file is part of the GNU ISO C++ Library. This library is free\n\
+// software; you can redistribute it and/or modify it under the\n\
+// terms of the GNU General Public License as published by the\n\
+// Free Software Foundation; either version 3, or (at your option)\n\
+// any later version.\n\
+\n\
+// This library is distributed in the hope that it will be useful,\n\
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+// GNU General Public License for more details.\n\
+\n\
+// You should have received a copy of the GNU General Public License along\n\
+// with this library; see the file COPYING3. If not see\n\
+// <http://www.gnu.org/licenses/>.\n\
+\n\
+// 2013-10-08 Tim Shen <timshen91@gmail.com>\n\
+\n\
+#include <testsuite_performance.h>\n\
+#include <regex>\n\
+\n\
+using namespace __gnu_test;\n\
+using namespace std;\n\
+\n\
+void split(string s)\n\
+{\n\
+ regex re(\"\\s+\");\n\
+ for (auto it = sregex_token_iterator(s.begin(), s.end(), re, -1);\n\
+ it != sregex_token_iterator();\n\
+ ++it)\n\
+ {\n\
+ }\n\
+}\n\
+\n\
+int main()\n\
+{\n\
+ string source = \"\";\n\
+ time_counter time;\n\
+ resource_counter resource;\n\
+\n\
+ source = source + source;\n\
+ source = source + source;\n\
+ source = source + source;\n\
+ source = source + source;\n\
+ source = source + source;\n\
+ source = source + source;\n\
+ source = source + source;\n\
+ source = source + source;\n\
+\n\
+ start_counters(time, resource);\n\
+ split(source);\n\
+ stop_counters(time, resource);\n\
+ report_performance(__FILE__, \"\", time, resource);\n\
+\n\
+ return 0;\n\
+}\n";
diff --git a/libstdc++-v3/testsuite/performance/28_regex/split_bfs.cc b/libstdc++-v3/testsuite/performance/28_regex/split_bfs.cc
new file mode 100644
index 00000000000..de2ef76a12f
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/28_regex/split_bfs.cc
@@ -0,0 +1,46 @@
+// Copyright (C) 2013 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 2013-10-26 Tim Shen <timshen91@gmail.com>
+
+#include <testsuite_performance.h>
+#define _GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT 0
+#include "split.h"
+
+using namespace __gnu_test;
+
+int main()
+{
+ time_counter time;
+ resource_counter resource;
+
+ source = source + source;
+ source = source + source;
+ source = source + source;
+ source = source + source;
+ source = source + source;
+ source = source + source;
+ source = source + source;
+ source = source + source;
+
+ start_counters(time, resource);
+ split(source);
+ stop_counters(time, resource);
+ report_performance(__FILE__, "", time, resource);
+
+ return 0;
+}