diff options
| author | Christoph Berg <myon@debian.org> | 2020-05-11 22:17:58 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2020-05-11 22:17:58 +0200 |
| commit | 32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (patch) | |
| tree | c6e107c1ee4d70610e43a7912e57c720334a08c7 /boost/libs/math/tools/process_perf_results.cpp | |
| parent | 08299e8b2bf50ba90daf570f57def529dd29d6e7 (diff) | |
New upstream version 2.2.0~rc1+repackupstream/2.2.0_rc1+repack
Diffstat (limited to 'boost/libs/math/tools/process_perf_results.cpp')
| -rw-r--r-- | boost/libs/math/tools/process_perf_results.cpp | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/boost/libs/math/tools/process_perf_results.cpp b/boost/libs/math/tools/process_perf_results.cpp deleted file mode 100644 index ecc6feb8..00000000 --- a/boost/libs/math/tools/process_perf_results.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright John Maddock 2007. - -// 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 <map> -#include <fstream> -#include <iostream> -#include <boost/regex.hpp> -#include <boost/lexical_cast.hpp> -#include <boost/format.hpp> -#include <boost/math/special_functions.hpp> - -std::map<std::string, double> results; - -std::map<std::string, std::string> extra_text; - -void load_file(std::string& s, std::istream& is) -{ - s.erase(); - if(is.bad()) return; - s.reserve(is.rdbuf()->in_avail()); - char c; - while(is.get(c)) - { - if(s.capacity() == s.size()) - s.reserve(s.capacity() * 3); - s.append(1, c); - } -} - -int main(int argc, const char* argv[]) -{ - // - // Set any additional text that should accumpany specific results: - // - extra_text["msvc-dist-beta-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]"; - extra_text["msvc-dist-nbinom-R-quantile"] = "[footnote The R library appears to use a linear-search strategy, that can perform very badly in a small number of pathological cases, but may or may not be more efficient in \"typical\" cases]"; - extra_text["gcc-4_3_2-dist-beta-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]"; - extra_text["gcc-4_3_2-dist-nbinom-R-quantile"] = "[footnote The R library appears to use a linear-search strategy, that can perform very badly in a small number of pathological cases, but may or may not be more efficient in \"typical\" cases]"; - extra_text["msvc-dist-hypergeometric-cdf"] = "[footnote This result is somewhat misleading: for small values of the parameters there is virtually no difference between the two libraries, but for large values the Boost implementation is /much/ slower, albeit with much improved precision.]"; - extra_text["msvc-dist-nt-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]"; - extra_text["msvc-dist-nchisq-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]"; - extra_text["gcc-4_3_2-dist-hypergeometric-cdf"] = "[footnote This result is somewhat misleading: for small values of the parameters there is virtually no difference between the two libraries, but for large values the Boost implementation is /much/ slower, albeit with much improved precision.]"; - extra_text["gcc-4_3_2-dist-nt-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]"; - extra_text["gcc-4_3_2-dist-nchisq-R-quantile"] = "[footnote There are a small number of our test cases where the R library fails to converge on a result: these tend to dominate the performance result.]"; - - boost::regex e("^Testing\\s+(\\S+)\\s+(\\S+)"); - std::string f; - for(int i = 1; i < argc-1; ++i) - { - std::ifstream is(argv[i]); - load_file(f, is); - boost::sregex_iterator a(f.begin(), f.end(), e), b; - while(a != b) - { - results[(*a).str(1)] = boost::lexical_cast<double>((*a).str(2)); - ++a; - } - } - // - // Load quickbook file: - // - std::ifstream is(argv[argc-1]); - std::string bak_file = std::string(argv[argc-1]).append(".bak"); - std::ofstream os(bak_file.c_str()); - e.assign( - "\\[perf\\s+([^\\s.]+)" - "(?:" - "\\[[^\\]\\[]*" - "(?:\\[[^\\]\\[]*\\][^\\]\\[]*)?" - "\\]" - "|[^\\]]" - ")*\\]"); - std::string newfile; - while(is.good()) - { - std::getline(is, f); - os << f << std::endl; - boost::sregex_iterator i(f.begin(), f.end(), e), j; - double min = (std::numeric_limits<double>::max)(); - while(i != j) - { - std::cout << (*i).str() << std::endl << (*i).str(1) << std::endl; - std::string item = (*i).str(1); - if(results.find(item) != results.end()) - { - double r = results[item]; - if(r < min) - min = r; - } - ++i; - } - // - // Now perform the substitutions: - // - std::string newstr; - std::string tail; - i = boost::sregex_iterator(f.begin(), f.end(), e); - while(i != j) - { - std::string item = (*i).str(1); - newstr.append(i->prefix()); - if(results.find(item) != results.end()) - { - double v = results[item]; - double r = v / min; - newstr += std::string((*i)[0].first, (*i)[1].second); - newstr += "..[para "; - if(r < 1.01) - newstr += "*"; - newstr += (boost::format("%.2f") % r).str(); - if(r < 1.01) - newstr += "*"; - if(extra_text.find(item) != extra_text.end()) - { - newstr += extra_text[item]; - } - newstr += "][para ("; - newstr += (boost::format("%.3e") % results[item]).str(); - newstr += "s)]]"; - } - else - { - newstr.append(i->str()); - std::cerr << "Item " << item << " not found!!" << std::endl; - } - tail = i->suffix(); - ++i; - } - if(newstr.size()) - newfile.append(newstr).append(tail); - else - newfile.append(f); - newfile.append("\n"); - } - is.close(); - std::ofstream ns(argv[argc-1]); - ns << newfile; -} - |
