summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/xpressive/perf
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/xpressive/perf')
-rw-r--r--src/boost/libs/xpressive/perf/Jamfile.v244
-rw-r--r--src/boost/libs/xpressive/perf/command_line.cpp261
-rw-r--r--src/boost/libs/xpressive/perf/gcc/long_twain_search.xml37
-rw-r--r--src/boost/libs/xpressive/perf/gcc/short_matches.xml57
-rw-r--r--src/boost/libs/xpressive/perf/gcc/short_twain_search.xml7
-rw-r--r--src/boost/libs/xpressive/perf/main.cpp193
-rw-r--r--src/boost/libs/xpressive/perf/msvc/long_twain_search.xml37
-rw-r--r--src/boost/libs/xpressive/perf/msvc/short_matches.xml57
-rw-r--r--src/boost/libs/xpressive/perf/msvc/short_twain_search.xml7
-rw-r--r--src/boost/libs/xpressive/perf/regex_comparison.hpp139
-rw-r--r--src/boost/libs/xpressive/perf/time_boost.cpp105
-rw-r--r--src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp105
-rw-r--r--src/boost/libs/xpressive/perf/time_static_xpressive.cpp224
13 files changed, 1273 insertions, 0 deletions
diff --git a/src/boost/libs/xpressive/perf/Jamfile.v2 b/src/boost/libs/xpressive/perf/Jamfile.v2
new file mode 100644
index 000000000..7769420e4
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/Jamfile.v2
@@ -0,0 +1,44 @@
+# Copyright Eric Niebler 2006
+
+# Use, modification, and distribution is subject to the Boost Software
+# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+#project
+# : requirements <library>../../../../boost/libs/regex/build//boost_regex
+# ;
+
+BOOST_REGEX_SOURCES =
+ c_regex_traits
+ cpp_regex_traits
+ cregex
+ fileiter
+ icu
+ instances
+ posix_api
+ regex
+ regex_debug
+ regex_raw_buffer
+ regex_traits_defaults
+ static_mutex
+ w32_regex_traits
+ wc_regex_traits
+ wide_posix_api
+ winstances
+ usinstances ;
+
+exe xprperf
+ :
+ command_line.cpp
+ main.cpp
+ time_boost.cpp
+ time_dynamic_xpressive.cpp
+ time_static_xpressive.cpp
+ $(BOOST_ROOT)/libs/regex/src/$(BOOST_REGEX_SOURCES).cpp
+ :
+ <include>$(BOOST_ROOT)
+ <define>BOOST_REGEX_NO_LIB=1
+ <define>BOOST_REGEX_RECURSIVE
+ <define>BOOST_REGEX_USE_CPP_LOCALE
+ <define>BOOST_XPRESSIVE_USE_CPP_TRAITS
+ ;
diff --git a/src/boost/libs/xpressive/perf/command_line.cpp b/src/boost/libs/xpressive/perf/command_line.cpp
new file mode 100644
index 000000000..1c77805d3
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/command_line.cpp
@@ -0,0 +1,261 @@
+// (C) Copyright Eric Niebler 2006.
+// Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <deque>
+#include <sstream>
+#include <stdexcept>
+#include <iterator>
+#include "./regex_comparison.hpp"
+
+//
+// globals:
+//
+bool time_boost = false;
+bool time_greta = false;
+bool time_safe_greta = false;
+bool time_dynamic_xpressive = false;
+bool time_static_xpressive = false;
+//bool time_posix = false;
+//bool time_pcre = false;
+
+bool test_matches = false;
+bool test_short_twain = false;
+bool test_long_twain = false;
+
+std::string xml_out_file;
+std::string xml_contents;
+std::list<results> result_list;
+
+int handle_argument(const std::string& what)
+{
+ if(what == "-b")
+ time_boost = true;
+ else if(what == "-g")
+ time_greta = true;
+ else if(what == "-gs")
+ time_safe_greta = true;
+ else if(what == "-dx")
+ time_dynamic_xpressive = true;
+ else if(what == "-sx")
+ time_static_xpressive = true;
+ //else if(what == "-posix")
+ // time_posix = true;
+ //else if(what == "-pcre")
+ // time_pcre = true;
+ else if(what == "-all")
+ {
+ time_boost = true;
+ time_greta = true;
+ time_safe_greta = true;
+ time_dynamic_xpressive = true;
+ time_static_xpressive = true;
+ //time_posix = true;
+ //time_pcre = true;
+ }
+ else if(what == "-test-matches")
+ test_matches = true;
+ else if(what == "-test-short-twain")
+ test_short_twain = true;
+ else if(what == "-test-long-twain")
+ test_long_twain = true;
+ else if(what == "-test-all")
+ {
+ test_matches = true;
+ test_short_twain = true;
+ test_long_twain = true;
+ }
+ else if((what == "-h") || (what == "--help"))
+ return show_usage();
+ else if((what[0] == '-') || (what[0] == '/'))
+ {
+ std::cerr << "Unknown argument: \"" << what << "\"" << std::endl;
+ return 1;
+ }
+ else if(xml_out_file.size() == 0)
+ {
+ xml_out_file = what;
+ }
+ else
+ {
+ std::cerr << "Unexpected argument: \"" << what << "\"" << std::endl;
+ return 1;
+ }
+ return 0;
+}
+
+int show_usage()
+{
+ std::cout <<
+ "Usage\n"
+ "xprperf [-h] [library options] [test options] [xml_output_file]\n"
+ " -h Show help\n\n"
+ " library options:\n"
+ " -b Apply tests to boost library\n"
+ //" -ba Apply tests to boost library with a custom allocator\n"
+ //" -be Apply tests to experimental boost library\n"
+ //" -g Apply tests to GRETA library\n"
+ //" -gs Apply tests to GRETA library (in non-recursive mode)\n"
+ " -dx Apply tests to dynamic xpressive library\n"
+ " -sx Apply tests to static xpressive library\n"
+ //" -posix Apply tests to POSIX library\n"
+ //" -pcre Apply tests to PCRE library\n"
+ " -all Apply tests to all libraries\n\n"
+ " test options:\n"
+ " -test-matches Test short matches\n"
+ " -test-short-twain Test short searches\n"
+ " -test-long-twain Test long searches\n"
+ " -test-all Test everthing\n";
+ return 1;
+}
+
+void load_file(std::string& text, const char* file)
+{
+ std::deque<char> temp_copy;
+ std::ifstream is(file);
+ if(!is.good())
+ {
+ std::string msg("Unable to open file: \"");
+ msg.append(file);
+ msg.append("\"");
+ throw std::runtime_error(msg);
+ }
+ std::istreambuf_iterator<char> it(is);
+ std::copy(it, std::istreambuf_iterator<char>(), std::back_inserter(temp_copy));
+ text.erase();
+ text.reserve(temp_copy.size());
+ text.append(temp_copy.begin(), temp_copy.end());
+}
+
+struct xml_double
+{
+ double d_;
+ xml_double( double d ) : d_(d) {}
+ friend std::ostream & operator<<( std::ostream & out, xml_double const & xd )
+ {
+ std::ostringstream tmp;
+ tmp << std::setprecision(out.precision()) << xd.d_;
+ std::string str = tmp.str();
+ std::string::size_type i = str.find( '-' );
+ if( i != std::string::npos )
+ str.replace( i, 1, "&#8209;" );
+ return out << str;
+ }
+};
+
+void print_result(std::ostream& os, double time, double best)
+{
+ static const char* suffixes[] = {"s", "ms", "us", "ns", "ps", };
+
+ if(time < 0)
+ {
+ os << "<entry>NA</entry>";
+ return;
+ }
+ double rel = time / best;
+ bool highlight = ((rel > 0) && (rel < 1.1));
+ unsigned suffix = 0;
+ while(time < 0)
+ {
+ time *= 1000;
+ ++suffix;
+ }
+ os << "<entry>";
+ if(highlight)
+ os << "<phrase role=\"highlight\">";
+ if(rel <= 1000)
+ os << std::setprecision(3) << xml_double(rel);
+ else
+ os << (int)rel;
+ os << "<para/>(";
+ if(time <= 1000)
+ os << std::setprecision(3) << xml_double(time);
+ else
+ os << (int)time;
+ os << suffixes[suffix] << ")";
+ if(highlight)
+ os << "</phrase>";
+ os << "</entry>";
+}
+
+void output_xml_results(bool show_description, const std::string& title, const std::string& filename)
+{
+ std::stringstream os;
+ // Generate the copyright and license on the output file
+ os << "<!--\n"
+ " Copyright 2004 Eric Niebler.\n"
+ "\n"
+ " Distributed under the Boost Software License, Version 1.0.\n"
+ " (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n"
+ "-->\n";
+
+ if(result_list.size())
+ {
+ // calculate the number of columns in this table
+ int num_cols = 1 + show_description + time_greta + time_safe_greta
+ + time_dynamic_xpressive + time_static_xpressive + time_boost;
+
+ //
+ // start by outputting the table header:
+ //
+ os << "<informaltable frame=\"all\">\n";
+ os << "<bridgehead renderas=\"sect4\">"
+ "<phrase role=\"table-title\">" << title << "</phrase>"
+ "</bridgehead>\n";
+ os << "<tgroup cols=\"" << num_cols << "\">\n";
+ os << "<thead>\n";
+ os << "<row>\n";
+
+ if(time_static_xpressive) os << "<entry>static xpressive</entry>";
+ if(time_dynamic_xpressive) os << "<entry>dynamic xpressive</entry>";
+ if(time_greta) os << "<entry>GRETA</entry>";
+ if(time_safe_greta) os << "<entry>GRETA<para/>(non-recursive mode)</entry>";
+ if(time_boost) os << "<entry>Boost</entry>";
+ //if(time_posix) os << "<entry>POSIX</entry>";
+ //if(time_pcre) os << "<entry>PCRE</entry>";
+ if(show_description) os << "<entry>Text</entry>";
+ os << "<entry>Expression</entry>";
+ os << "\n</row>\n";
+ os << "</thead>\n";
+ os << "<tbody>\n";
+
+ //
+ // Now enumerate through all the test results:
+ //
+ std::list<results>::const_iterator first, last;
+ first = result_list.begin();
+ last = result_list.end();
+ while(first != last)
+ {
+ os << "<row>\n";
+ if(time_static_xpressive) print_result(os, first->static_xpressive_time, first->factor);
+ if(time_dynamic_xpressive) print_result(os, first->dynamic_xpressive_time, first->factor);
+ if(time_greta) print_result(os, first->greta_time, first->factor);
+ if(time_safe_greta) print_result(os, first->safe_greta_time, first->factor);
+ if(time_boost) print_result(os, first->boost_time, first->factor);
+ //if(time_posix) print_result(os, first->posix_time, first->factor);
+ //if(time_pcre) print_result(os, first->pcre_time, first->factor);
+ if(show_description) os << "<entry>" << first->description << "</entry>";
+ os << "<entry><literal>" << first->expression << "</literal></entry>";
+ os << "\n</row>\n";
+ ++first;
+ }
+
+ os << "</tbody>\n"
+ "</tgroup>\n"
+ "</informaltable>\n";
+
+ result_list.clear();
+ }
+ else
+ {
+ os << "<para><emphasis>Results not available...</emphasis></para>\n";
+ }
+
+ std::ofstream file(filename.c_str());
+ file << os.str();
+}
diff --git a/src/boost/libs/xpressive/perf/gcc/long_twain_search.xml b/src/boost/libs/xpressive/perf/gcc/long_twain_search.xml
new file mode 100644
index 000000000..71efa3da9
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/gcc/long_twain_search.xml
@@ -0,0 +1,37 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Long Searches</phrase></bridgehead>
+<tgroup cols="4">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0263s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.0263s)</phrase></entry><entry>1.78<para/>(0.0469s)</entry><entry><literal>Twain</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0234s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.0234s)</phrase></entry><entry>1.79<para/>(0.042s)</entry><entry><literal>Huck[[:alpha:]]+</literal></entry>
+</row>
+<row>
+<entry>1.84<para/>(1.26s)</entry><entry>2.21<para/>(1.51s)</entry><entry><phrase role="highlight">1<para/>(0.687s)</phrase></entry><entry><literal>[[:alpha:]]+ing</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.09<para/>(0.192s)</phrase></entry><entry>2<para/>(0.351s)</entry><entry><phrase role="highlight">1<para/>(0.176s)</phrase></entry><entry><literal>^[^
+]*?Twain</literal></entry>
+</row>
+<row>
+<entry>1.41<para/>(0.08s)</entry><entry>1.21<para/>(0.0684s)</entry><entry><phrase role="highlight">1<para/>(0.0566s)</phrase></entry><entry><literal>Tom|Sawyer|Huckleberry|Finn</literal></entry>
+</row>
+<row>
+<entry>1.56<para/>(0.195s)</entry><entry>1.12<para/>(0.141s)</entry><entry><phrase role="highlight">1<para/>(0.125s)</phrase></entry><entry><literal>(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/gcc/short_matches.xml b/src/boost/libs/xpressive/perf/gcc/short_matches.xml
new file mode 100644
index 000000000..ee84e61a2
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/gcc/short_matches.xml
@@ -0,0 +1,57 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Short Matches</phrase></bridgehead>
+<tgroup cols="5">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Text</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(8.79e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1.08<para/>(9.54e&#8209;07s)</phrase></entry><entry>2.51<para/>(2.2e&#8209;06s)</entry><entry>100- this is a line of ftp response which contains a message string</entry><entry><literal>^([0-9]+)(\-| |$)(.*)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.06<para/>(1.07e&#8209;06s)</phrase></entry><entry><phrase role="highlight">1<para/>(1.01e&#8209;06s)</phrase></entry><entry>4.01<para/>(4.06e&#8209;06s)</entry><entry>1234-5678-1234-456</entry><entry><literal>([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(1.4e&#8209;06s)</phrase></entry><entry>1.13<para/>(1.58e&#8209;06s)</entry><entry>2.89<para/>(4.05e&#8209;06s)</entry><entry>john_maddock@compuserve.com</entry><entry><literal>^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(1.28e&#8209;06s)</phrase></entry><entry>1.16<para/>(1.49e&#8209;06s)</entry><entry>3.07<para/>(3.94e&#8209;06s)</entry><entry>foo12@foo.edu</entry><entry><literal>^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(1.22e&#8209;06s)</phrase></entry><entry>1.2<para/>(1.46e&#8209;06s)</entry><entry>3.22<para/>(3.93e&#8209;06s)</entry><entry>bob.smith@foo.tv</entry><entry><literal>^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.04<para/>(8.64e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1<para/>(8.34e&#8209;07s)</phrase></entry><entry>2.5<para/>(2.09e&#8209;06s)</entry><entry>EH10 2QQ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry>1.11<para/>(9.09e&#8209;07s)</entry><entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry>2.47<para/>(2.03e&#8209;06s)</entry><entry>G1 1AA</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry>1.12<para/>(9.38e&#8209;07s)</entry><entry><phrase role="highlight">1<para/>(8.34e&#8209;07s)</phrase></entry><entry>2.5<para/>(2.08e&#8209;06s)</entry><entry>SW1 1ZZ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(7.9e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1.06<para/>(8.34e&#8209;07s)</phrase></entry><entry>2.49<para/>(1.96e&#8209;06s)</entry><entry>4/1/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1.04<para/>(8.49e&#8209;07s)</phrase></entry><entry>2.4<para/>(1.97e&#8209;06s)</entry><entry>12/12/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.09<para/>(8.95e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry>2.4<para/>(1.96e&#8209;06s)</entry><entry>123</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry>1.11<para/>(8.79e&#8209;07s)</entry><entry><phrase role="highlight">1<para/>(7.9e&#8209;07s)</phrase></entry><entry>2.57<para/>(2.03e&#8209;06s)</entry><entry>+3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1.09<para/>(8.94e&#8209;07s)</phrase></entry><entry><phrase role="highlight">1<para/>(8.19e&#8209;07s)</phrase></entry><entry>2.47<para/>(2.03e&#8209;06s)</entry><entry>-3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/gcc/short_twain_search.xml b/src/boost/libs/xpressive/perf/gcc/short_twain_search.xml
new file mode 100644
index 000000000..52bc47898
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/gcc/short_twain_search.xml
@@ -0,0 +1,7 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+<para><emphasis>Results not available...</emphasis></para>
diff --git a/src/boost/libs/xpressive/perf/main.cpp b/src/boost/libs/xpressive/perf/main.cpp
new file mode 100644
index 000000000..19ea02e65
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/main.cpp
@@ -0,0 +1,193 @@
+/*
+ *
+ * Copyright (c) 2002
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <cassert>
+#include <boost/test/execution_monitor.hpp>
+#include "./regex_comparison.hpp"
+
+void test_match(const std::string& re, const std::string& text, const std::string& description)
+{
+ double time;
+ results r(re, description);
+
+ std::cout << "Testing: \"" << re << "\" against \"" << description << "\"" << std::endl;
+ if(time_greta == true)
+ {
+ // time = g::time_match(re, text);
+ // r.greta_time = time;
+ // std::cout << "\tGRETA regex: " << time << "s\n";
+ }
+ if(time_safe_greta == true)
+ {
+ // time = gs::time_match(re, text);
+ // r.safe_greta_time = time;
+ // std::cout << "\tSafe GRETA regex: " << time << "s\n";
+ }
+ if(time_dynamic_xpressive == true)
+ {
+ time = dxpr::time_match(re, text);
+ r.dynamic_xpressive_time = time;
+ std::cout << "\tdynamic xpressive regex: " << time << "s\n";
+ }
+ if(time_static_xpressive == true)
+ {
+ time = sxpr::time_match(re, text);
+ r.static_xpressive_time = time;
+ std::cout << "\tstatic xpressive regex: " << time << "s\n";
+ }
+ if(time_boost == true)
+ {
+ time = b::time_match(re, text);
+ r.boost_time = time;
+ std::cout << "\tBoost regex: " << time << "s\n";
+ }
+ //if(time_posix == true)
+ //{
+ // time = posix::time_match(re, text);
+ // r.posix_time = time;
+ // std::cout << "\tPOSIX regex: " << time << "s\n";
+ //}
+ //if(time_pcre == true)
+ //{
+ // time = pcr::time_match(re, text);
+ // r.pcre_time = time;
+ // std::cout << "\tPCRE regex: " << time << "s\n";
+ //}
+ r.finalise();
+ result_list.push_back(r);
+}
+
+void test_find_all(const std::string& re, const std::string& text, const std::string& description)
+{
+ std::cout << "Testing: " << re << std::endl;
+
+ double time;
+ results r(re, description);
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
+ if(time_greta == true)
+ {
+ // time = g::time_find_all(re, text);
+ // r.greta_time = time;
+ // std::cout << "\tGRETA regex: " << time << "s\n";
+ }
+ if(time_safe_greta == true)
+ {
+ // time = gs::time_find_all(re, text);
+ // r.safe_greta_time = time;
+ // std::cout << "\tSafe GRETA regex: " << time << "s\n";
+ }
+#endif
+ if(time_dynamic_xpressive == true)
+ {
+ time = dxpr::time_find_all(re, text);
+ r.dynamic_xpressive_time = time;
+ std::cout << "\tdynamic xpressive regex: " << time << "s\n";
+ }
+ if(time_static_xpressive == true)
+ {
+ time = sxpr::time_find_all(re, text);
+ r.static_xpressive_time = time;
+ std::cout << "\tstatic xpressive regex: " << time << "s\n";
+ }
+ if(time_boost == true)
+ {
+ time = b::time_find_all(re, text);
+ r.boost_time = time;
+ std::cout << "\tBoost regex: " << time << "s\n";
+ }
+ //if(time_posix == true)
+ //{
+ // time = posix::time_find_all(re, text);
+ // r.posix_time = time;
+ // std::cout << "\tPOSIX regex: " << time << "s\n";
+ //}
+ //if(time_pcre == true)
+ //{
+ // time = pcr::time_find_all(re, text);
+ // r.pcre_time = time;
+ // std::cout << "\tPCRE regex: " << time << "s\n";
+ //}
+ r.finalise();
+ result_list.push_back(r);
+}
+
+//int cpp_main(int argc, char**const argv)
+int main(int argc, char**const argv)
+{
+ // start by processing the command line args:
+ if(argc < 2)
+ return show_usage();
+ int result = 0;
+ for(int c = 1; c < argc; ++c)
+ {
+ result += handle_argument(argv[c]);
+ }
+ if(result)
+ return result;
+
+ if(test_matches)
+ {
+ // these are from the regex docs:
+ test_match("^([0-9]+)(\\-| |$)(.*)$", "100- this is a line of ftp response which contains a message string");
+ test_match("([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}", "1234-5678-1234-456");
+ // these are from http://www.regxlib.com/
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "john_maddock@compuserve.com");
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "foo12@foo.edu");
+ test_match("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", "bob.smith@foo.tv");
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "EH10 2QQ");
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "G1 1AA");
+ test_match("^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$", "SW1 1ZZ");
+ test_match("^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$", "4/1/2001");
+ test_match("^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$", "12/12/2001");
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "123");
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "+3.14159");
+ test_match("^[-+]?[[:digit:]]*\\.?[[:digit:]]*$", "-3.14159");
+
+ output_xml_results(true, "Short Matches", "short_matches.xml");
+ }
+ std::string twain;
+
+ if(test_short_twain)
+ {
+ load_file(twain, "short_twain.txt");
+
+ test_find_all("Twain", twain);
+ test_find_all("Huck[[:alpha:]]+", twain);
+ test_find_all("[[:alpha:]]+ing", twain);
+ test_find_all("^[^\n]*?Twain", twain);
+ test_find_all("Tom|Sawyer|Huckleberry|Finn", twain);
+ test_find_all("(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)", twain);
+
+ output_xml_results(false, "Moderate Searches", "short_twain_search.xml");
+ }
+
+ if(test_long_twain)
+ {
+ load_file(twain, "3200.txt");
+
+ test_find_all("Twain", twain);
+ test_find_all("Huck[[:alpha:]]+", twain);
+ test_find_all("[[:alpha:]]+ing", twain);
+ test_find_all("^[^\n]*?Twain", twain);
+ test_find_all("Tom|Sawyer|Huckleberry|Finn", twain);
+ //time_posix = false;
+ test_find_all("(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)", twain);
+ //time_posix = true;
+
+ output_xml_results(false, "Long Searches", "long_twain_search.xml");
+ }
+
+ return 0;
+}
diff --git a/src/boost/libs/xpressive/perf/msvc/long_twain_search.xml b/src/boost/libs/xpressive/perf/msvc/long_twain_search.xml
new file mode 100644
index 000000000..bf8d5f1f2
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/msvc/long_twain_search.xml
@@ -0,0 +1,37 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Long Searches</phrase></bridgehead>
+<tgroup cols="4">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(0.019s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.019s)</phrase></entry><entry>2.98<para/>(0.0566s)</entry><entry><literal>Twain</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0176s)</phrase></entry><entry><phrase role="highlight">1<para/>(0.0176s)</phrase></entry><entry>3.17<para/>(0.0556s)</entry><entry><literal>Huck[[:alpha:]]+</literal></entry>
+</row>
+<row>
+<entry>3.62<para/>(1.78s)</entry><entry>3.97<para/>(1.95s)</entry><entry><phrase role="highlight">1<para/>(0.492s)</phrase></entry><entry><literal>[[:alpha:]]+ing</literal></entry>
+</row>
+<row>
+<entry>2.32<para/>(0.344s)</entry><entry>3.06<para/>(0.453s)</entry><entry><phrase role="highlight">1<para/>(0.148s)</phrase></entry><entry><literal>^[^
+]*?Twain</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(0.0576s)</phrase></entry><entry><phrase role="highlight">1.05<para/>(0.0606s)</phrase></entry><entry>1.15<para/>(0.0664s)</entry><entry><literal>Tom|Sawyer|Huckleberry|Finn</literal></entry>
+</row>
+<row>
+<entry>1.24<para/>(0.164s)</entry><entry>1.44<para/>(0.191s)</entry><entry><phrase role="highlight">1<para/>(0.133s)</phrase></entry><entry><literal>(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/msvc/short_matches.xml b/src/boost/libs/xpressive/perf/msvc/short_matches.xml
new file mode 100644
index 000000000..0adcdb3d7
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/msvc/short_matches.xml
@@ -0,0 +1,57 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+<informaltable frame="all">
+<bridgehead renderas="sect4"><phrase role="table-title">Short Matches</phrase></bridgehead>
+<tgroup cols="5">
+<thead>
+<row>
+<entry>static xpressive</entry><entry>dynamic xpressive</entry><entry>Boost</entry><entry>Text</entry><entry>Expression</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry><phrase role="highlight">1<para/>(3.2e&#8209;007s)</phrase></entry><entry>1.37<para/>(4.4e&#8209;007s)</entry><entry>2.38<para/>(7.6e&#8209;007s)</entry><entry>100- this is a line of ftp response which contains a message string</entry><entry><literal>^([0-9]+)(\-| |$)(.*)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(6.4e&#8209;007s)</phrase></entry><entry>1.12<para/>(7.15e&#8209;007s)</entry><entry>1.72<para/>(1.1e&#8209;006s)</entry><entry>1234-5678-1234-456</entry><entry><literal>([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(9.82e&#8209;007s)</phrase></entry><entry>1.3<para/>(1.28e&#8209;006s)</entry><entry>1.61<para/>(1.58e&#8209;006s)</entry><entry>john_maddock@compuserve.com</entry><entry><literal>^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(8.94e&#8209;007s)</phrase></entry><entry>1.3<para/>(1.16e&#8209;006s)</entry><entry>1.7<para/>(1.52e&#8209;006s)</entry><entry>foo12@foo.edu</entry><entry><literal>^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(9.09e&#8209;007s)</phrase></entry><entry>1.28<para/>(1.16e&#8209;006s)</entry><entry>1.67<para/>(1.52e&#8209;006s)</entry><entry>bob.smith@foo.tv</entry><entry><literal>^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.06e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.07<para/>(3.28e&#8209;007s)</phrase></entry><entry>1.95<para/>(5.96e&#8209;007s)</entry><entry>EH10 2QQ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.13e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.09<para/>(3.42e&#8209;007s)</phrase></entry><entry>1.86<para/>(5.81e&#8209;007s)</entry><entry>G1 1AA</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.2e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.09<para/>(3.5e&#8209;007s)</phrase></entry><entry>1.86<para/>(5.96e&#8209;007s)</entry><entry>SW1 1ZZ</entry><entry><literal>^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(2.68e&#8209;007s)</phrase></entry><entry>1.22<para/>(3.28e&#8209;007s)</entry><entry>2<para/>(5.36e&#8209;007s)</entry><entry>4/1/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(2.76e&#8209;007s)</phrase></entry><entry>1.16<para/>(3.2e&#8209;007s)</entry><entry>1.94<para/>(5.36e&#8209;007s)</entry><entry>12/12/2001</entry><entry><literal>^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(2.98e&#8209;007s)</phrase></entry><entry><phrase role="highlight">1.03<para/>(3.06e&#8209;007s)</phrase></entry><entry>1.85<para/>(5.51e&#8209;007s)</entry><entry>123</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.2e&#8209;007s)</phrase></entry><entry>1.12<para/>(3.58e&#8209;007s)</entry><entry>1.81<para/>(5.81e&#8209;007s)</entry><entry>+3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+<row>
+<entry><phrase role="highlight">1<para/>(3.28e&#8209;007s)</phrase></entry><entry>1.11<para/>(3.65e&#8209;007s)</entry><entry>1.77<para/>(5.81e&#8209;007s)</entry><entry>-3.14159</entry><entry><literal>^[-+]?[[:digit:]]*\.?[[:digit:]]*$</literal></entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
diff --git a/src/boost/libs/xpressive/perf/msvc/short_twain_search.xml b/src/boost/libs/xpressive/perf/msvc/short_twain_search.xml
new file mode 100644
index 000000000..52bc47898
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/msvc/short_twain_search.xml
@@ -0,0 +1,7 @@
+<!--
+ Copyright 2004 Eric Niebler.
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+<para><emphasis>Results not available...</emphasis></para>
diff --git a/src/boost/libs/xpressive/perf/regex_comparison.hpp b/src/boost/libs/xpressive/perf/regex_comparison.hpp
new file mode 100644
index 000000000..d293049d6
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/regex_comparison.hpp
@@ -0,0 +1,139 @@
+/*
+ *
+ * Copyright (c) 2002
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+
+#ifndef REGEX_COMPARISON_HPP
+#define REGEX_COMPARISON_HPP
+
+#include <string>
+#include <list>
+#include <boost/limits.hpp>
+
+//
+// globals:
+//
+extern bool time_boost;
+extern bool time_greta;
+extern bool time_safe_greta;
+extern bool time_dynamic_xpressive;
+extern bool time_static_xpressive;
+//extern bool time_posix;
+//extern bool time_pcre;
+
+extern bool test_matches;
+extern bool test_short_twain;
+extern bool test_long_twain;
+
+extern std::string xml_out_file;
+extern std::string xml_contents;
+
+
+int handle_argument(const std::string& what);
+int show_usage();
+void load_file(std::string& text, const char* file);
+void output_xml_results(bool show_description, const std::string& title, const std::string& filename);
+
+struct results
+{
+ double boost_time;
+ double greta_time;
+ double safe_greta_time;
+ double dynamic_xpressive_time;
+ double static_xpressive_time;
+ //double posix_time;
+ //double pcre_time;
+ double factor;
+ std::string expression;
+ std::string description;
+ results(const std::string& ex, const std::string& desc)
+ : boost_time(-1),
+ greta_time(-1),
+ safe_greta_time(-1),
+ dynamic_xpressive_time(-1),
+ static_xpressive_time(-1),
+ //posix_time(-1),
+ //pcre_time(-1),
+ factor((std::numeric_limits<double>::max)()),
+ expression(ex),
+ description(desc)
+ {}
+ void finalise()
+ {
+ if((boost_time >= 0) && (boost_time < factor))
+ factor = boost_time;
+ if((greta_time >= 0) && (greta_time < factor))
+ factor = greta_time;
+ if((safe_greta_time >= 0) && (safe_greta_time < factor))
+ factor = safe_greta_time;
+ if((dynamic_xpressive_time >= 0) && (dynamic_xpressive_time < factor))
+ factor = dynamic_xpressive_time;
+ if((static_xpressive_time >= 0) && (static_xpressive_time < factor))
+ factor = static_xpressive_time;
+ //if((posix_time >= 0) && (posix_time < factor))
+ // factor = posix_time;
+ //if((pcre_time >= 0) && (pcre_time < factor))
+ // factor = pcre_time;
+ if((factor >= 0) && (factor < factor))
+ factor = factor;
+ }
+};
+
+extern std::list<results> result_list;
+
+
+namespace b {
+// boost tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+//namespace posix {
+//// posix tests:
+//double time_match(const std::string& re, const std::string& text);
+//double time_find_all(const std::string& re, const std::string& text);
+//
+//}
+//namespace pcr {
+//// pcre tests:
+//double time_match(const std::string& re, const std::string& text);
+//double time_find_all(const std::string& re, const std::string& text);
+//
+//}
+namespace g {
+// greta tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+namespace gs {
+// safe greta tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+namespace dxpr {
+// dynamic xpressive tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+namespace sxpr {
+// static xpressive tests:
+double time_match(const std::string& re, const std::string& text);
+double time_find_all(const std::string& re, const std::string& text);
+}
+void test_match(const std::string& re, const std::string& text, const std::string& description);
+void test_find_all(const std::string& re, const std::string& text, const std::string& description);
+inline void test_match(const std::string& re, const std::string& text)
+{ test_match(re, text, text); }
+inline void test_find_all(const std::string& re, const std::string& text)
+{ test_find_all(re, text, ""); }
+
+
+#define REPEAT_COUNT 10
+
+#endif
diff --git a/src/boost/libs/xpressive/perf/time_boost.cpp b/src/boost/libs/xpressive/perf/time_boost.cpp
new file mode 100644
index 000000000..420f141c2
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/time_boost.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 2002
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+#include "./regex_comparison.hpp"
+#include <boost/timer.hpp>
+#include <boost/regex.hpp>
+
+namespace b{
+
+double time_match(const std::string& re, const std::string& text)
+{
+ boost::regex e(re, boost::regex_constants::ECMAScript | boost::regex_constants::optimize);
+ boost::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::regex_match(text, what, e);
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::regex_match(text, what, e);
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+//bool dummy_grep_proc(const boost::smatch&)
+//{ return true; }
+
+struct noop
+{
+ void operator()( boost::smatch const & ) const
+ {
+ }
+};
+
+double time_find_all(const std::string& re, const std::string& text)
+{
+ boost::regex e(re, boost::regex_constants::ECMAScript | boost::regex_constants::optimize);
+ boost::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ //boost::regex_grep(&dummy_grep_proc, text, e);
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ if(result >10)
+ return result / iter;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ //boost::regex_grep(&dummy_grep_proc, text, e);
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+}
diff --git a/src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp b/src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp
new file mode 100644
index 000000000..d6f0a98f0
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/time_dynamic_xpressive.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 2002
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+#include "./regex_comparison.hpp"
+#include <cassert>
+#include <boost/timer.hpp>
+#include <boost/xpressive/xpressive.hpp>
+
+namespace dxpr
+{
+
+double time_match(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex e(boost::xpressive::sregex::compile(re, boost::xpressive::regex_constants::optimize));
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ assert(boost::xpressive::regex_match( text, what, e ));
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ } while(result < 0.5);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+struct noop
+{
+ void operator()( boost::xpressive::smatch const & ) const
+ {
+ }
+};
+
+double time_find_all(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex e(boost::xpressive::sregex::compile(re, boost::xpressive::regex_constants::optimize));
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ if(result >10)
+ return result / iter;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+}
+
+
diff --git a/src/boost/libs/xpressive/perf/time_static_xpressive.cpp b/src/boost/libs/xpressive/perf/time_static_xpressive.cpp
new file mode 100644
index 000000000..b90d6b32f
--- /dev/null
+++ b/src/boost/libs/xpressive/perf/time_static_xpressive.cpp
@@ -0,0 +1,224 @@
+/*
+ *
+ * Copyright (c) 2002
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+#include "./regex_comparison.hpp"
+#include <map>
+#include <cassert>
+#include <boost/timer.hpp>
+#include <boost/xpressive/xpressive.hpp>
+
+namespace sxpr
+{
+
+using namespace boost::xpressive;
+
+// short matches
+char const * sz1 = "^([0-9]+)(\\-| |$)(.*)$";
+sregex rx1 = bol >> (s1= +range('0','9')) >> (s2= as_xpr('-')|' '|eol) >> (s3= *_) >> eol;
+
+char const * sz2 = "([[:digit:]]{4}[- ]){3}[[:digit:]]{3,4}";
+sregex rx2 = bol >> repeat<3>(s1= repeat<4>(set[digit]) >> (set='-',' ')) >> repeat<3,4>(set[digit]);
+
+char const * sz3 = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
+sregex rx3
+ = bol
+ >> (s1= +set[ range('a','z') | range('A','Z') | range('0','9') | '_' | '-' | '.' ])
+ >> '@'
+ >> (s2=
+ (s3= '[' >> repeat<1,3>(range('0','9')) >> '.' >> repeat<1,3>(range('0','9'))
+ >> '.' >> repeat<1,3>(range('0','9')) >> '.'
+ )
+ |
+ (s4= +(s5= +set[ range('a','z') | range('A','Z') | range('0','9') | '-' ] >> '.' ) )
+ )
+ >> (s6= repeat<2,4>(set[ range('a','z') | range('A','Z')]) | repeat<1,3>(range('0','9')))
+ >> (s7= !as_xpr(']'))
+ >> eol
+ ;
+
+char const * sz4 = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
+sregex rx4 = rx3;
+
+char const * sz5 = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
+sregex rx5 = rx3;
+
+char const * sz6 = "^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$";
+sregex rx6 = bol >> repeat<1,2>(set[ range('a','z') | range('A','Z') ])
+ >> range('0','9') >> repeat<0,1>(set[range('0','9')|range('A','Z')|range('a','z')])
+ >> repeat<0,1>(as_xpr(' ')) >> range('0','9')
+ >> repeat<2>(set[range('A','Z')|range('a','z')]) >> eol;
+
+char const * sz7 = "^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$";
+sregex rx7 = rx6;
+
+char const * sz8 = "^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$";
+sregex rx8 = rx6;
+
+char const * sz9 = "^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$";
+sregex rx9 = bol >> repeat<1,2>(set[digit]) >> '/' >> repeat<1,2>(set[digit]) >> '/' >> repeat<4>(set[digit]) >> eol;
+
+char const * sz10 = "^[[:digit:]]{1,2}/[[:digit:]]{1,2}/[[:digit:]]{4}$";
+sregex rx10 = rx9;
+
+char const * sz11 = "^[-+]?[[:digit:]]*\\.?[[:digit:]]*$";
+sregex rx11 = bol >> !(set= '-','+') >> *set[digit] >> !as_xpr('.') >> *set[digit] >> eol ;
+
+char const * sz12 = "^[-+]?[[:digit:]]*\\.?[[:digit:]]*$";
+sregex rx12 = rx11;
+
+char const * sz13 = "^[-+]?[[:digit:]]*\\.?[[:digit:]]*$";
+sregex rx13 = rx11;
+
+// long matches
+char const * sz14 = "Twain";
+boost::xpressive::sregex rx14 = as_xpr("Twain");
+
+char const * sz15 = "Huck[[:alpha:]]+";
+boost::xpressive::sregex rx15 = "Huck" >> +set[alpha];
+
+char const * sz16 = "[[:alpha:]]+ing";
+boost::xpressive::sregex rx16 = +set[alpha] >> "ing";
+
+char const * sz17 = "^[^\n]*?Twain";
+boost::xpressive::sregex rx17 = bol >> -*~as_xpr('\n') >> "Twain";
+
+char const * sz18 = "Tom|Sawyer|Huckleberry|Finn";
+boost::xpressive::sregex rx18 = ( as_xpr("Tom") | "Sawyer" | "Huckleberry" | "Finn" );
+
+//char const * sz18 = "Tom|Sawyer|.uckleberry|Finn";
+//boost::xpressive::sregex rx18 = ( as_xpr("Tom") | "Sawyer" | _ >> "uckleberry" | "Finn" );
+
+char const * sz19 = "(Tom|Sawyer|Huckleberry|Finn).{0,30}river|river.{0,30}(Tom|Sawyer|Huckleberry|Finn)";
+boost::xpressive::sregex rx19 =
+ (s1= as_xpr("Tom") | "Sawyer" | "Huckleberry" | "Finn" )
+ >> repeat<0,30>(_)
+ >> "river"
+ |
+ "river"
+ >> repeat<0,30>(_)
+ >> (s2= as_xpr("Tom") | "Sawyer" | "Huckleberry" | "Finn" );
+
+std::map< std::string, sregex > rxmap;
+
+struct map_init
+{
+ map_init()
+ {
+ rxmap[ sz1 ] = rx1;
+ rxmap[ sz2 ] = rx2;
+ rxmap[ sz3 ] = rx3;
+ rxmap[ sz4 ] = rx4;
+ rxmap[ sz5 ] = rx5;
+ rxmap[ sz6 ] = rx6;
+ rxmap[ sz7 ] = rx7;
+ rxmap[ sz8 ] = rx8;
+ rxmap[ sz9 ] = rx9;
+ rxmap[ sz10 ] = rx10;
+ rxmap[ sz11 ] = rx11;
+ rxmap[ sz12 ] = rx12;
+ rxmap[ sz13 ] = rx13;
+ rxmap[ sz14 ] = rx14;
+ rxmap[ sz15 ] = rx15;
+ rxmap[ sz16 ] = rx16;
+ rxmap[ sz17 ] = rx17;
+ rxmap[ sz18 ] = rx18;
+ rxmap[ sz19 ] = rx19;
+ }
+};
+
+static map_init const i = map_init();
+
+double time_match(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex const &e = rxmap[ re ];
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ assert(boost::xpressive::regex_match( text, what, e ));
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ } while(result < 0.5);
+ iter /= 2;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::regex_match( text, what, e );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+struct noop
+{
+ void operator()( boost::xpressive::smatch const & ) const
+ {
+ }
+};
+
+double time_find_all(const std::string& re, const std::string& text)
+{
+ boost::xpressive::sregex const &e = rxmap[ re ];
+ boost::xpressive::smatch what;
+ boost::timer tim;
+ int iter = 1;
+ int counter, repeats;
+ double result = 0;
+ double run;
+ do
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ result = tim.elapsed();
+ iter *= 2;
+ }while(result < 0.5);
+ iter /= 2;
+
+ if(result >10)
+ return result / iter;
+
+ // repeat test and report least value for consistency:
+ for(repeats = 0; repeats < REPEAT_COUNT; ++repeats)
+ {
+ tim.restart();
+ for(counter = 0; counter < iter; ++counter)
+ {
+ boost::xpressive::sregex_iterator begin( text.begin(), text.end(), e ), end;
+ std::for_each( begin, end, noop() );
+ }
+ run = tim.elapsed();
+ result = (std::min)(run, result);
+ }
+ return result / iter;
+}
+
+}
+
+