Revision: 75793
          http://sourceforge.net/p/brlcad/code/75793
Author:   starseeker
Date:     2020-05-14 04:59:20 +0000 (Thu, 14 May 2020)
Log Message:
-----------
On Linux, a preliminary filter with strstr, even with the acknowledged 
inefficiency of continually recreating the lower case keys, gets us under two 
seconds

Modified Paths:
--------------
    brlcad/trunk/regress/repository/repocheck.cpp

Modified: brlcad/trunk/regress/repository/repocheck.cpp
===================================================================
--- brlcad/trunk/regress/repository/repocheck.cpp       2020-05-14 03:33:03 UTC 
(rev 75792)
+++ brlcad/trunk/regress/repository/repocheck.cpp       2020-05-14 04:59:20 UTC 
(rev 75793)
@@ -39,6 +39,7 @@
  *
  */
 
+#include <cstring>
 #include <cstdio>
 #include <algorithm>
 #include <locale>
@@ -465,6 +466,12 @@
        lcnt++;
        std::map<std::string, std::regex>::iterator ff_it;
        for (ff_it = l.api_func_filters.begin(); ff_it != 
l.api_func_filters.end(); ff_it++) {
+           std::string p_lower = ff_it->first;
+           std::transform(p_lower.begin(), p_lower.end(), p_lower.begin(), 
[](unsigned char c){ return std::tolower(c); });
+           if (!std::strstr(sline.c_str(), ff_it->first.c_str()) && 
!std::strstr(sline.c_str(), p_lower.c_str())) {
+               // Only try the full regex if strstr says there is a chance
+               continue;
+           }
            if (std::regex_match(sline, ff_it->second)) {
                // If we have a it, make sure it's not an exemption
                bool exempt = false;
@@ -529,6 +536,12 @@
 
        std::map<std::string, std::regex>::iterator  p_it;
        for (p_it = l.platform_checks.begin(); p_it != l.platform_checks.end(); 
p_it++) {
+           std::string p_lower = p_it->first;
+           std::transform(p_lower.begin(), p_lower.end(), p_lower.begin(), 
[](unsigned char c){ return std::tolower(c); });
+           if (!std::strstr(sline.c_str(), p_it->first.c_str()) && 
!std::strstr(sline.c_str(), p_lower.c_str())) {
+               // Only try the full regex if strstr says there is a chance
+               continue;
+           }
            if (std::regex_match(sline, p_it->second)) {
                //std::cout << "match on line: " << sline << "\n";
                platform_entry pe;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to