Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package re2 for openSUSE:Factory checked in at 2022-06-03 14:15:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/re2 (Old) and /work/SRC/openSUSE:Factory/.re2.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "re2" Fri Jun 3 14:15:29 2022 rev:48 rq:980402 version:MACRO Changes: -------- --- /work/SRC/openSUSE:Factory/re2/re2.changes 2022-05-04 15:10:17.728108931 +0200 +++ /work/SRC/openSUSE:Factory/.re2.new.1548/re2.changes 2022-06-03 14:15:42.481241767 +0200 @@ -1,0 +2,6 @@ +Wed Jun 1 19:38:17 UTC 2022 - Andreas Stieger <andreas.stie...@gmx.de> + +- update to 2022-06-01: + * switch to cxx_std_11 and other developer visible fixes + +------------------------------------------------------------------- Old: ---- re2-2022-04-01.tar.gz New: ---- re2-2022-06-01.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ re2.spec ++++++ --- /var/tmp/diff_new_pack.SrxF2Q/_old 2022-06-03 14:15:42.977242412 +0200 +++ /var/tmp/diff_new_pack.SrxF2Q/_new 2022-06-03 14:15:42.985242422 +0200 @@ -16,11 +16,12 @@ # -%global longver 2022-04-01 +%global longver 2022-06-01 %global shortver %(echo %{longver}|sed 's|-||g') %define libname libre2-9 +%ifarch s390 s390x riscv64 armv6l armv6hl %bcond_with test -%ifnarch s390 s390x riscv64 armv6l armv6hl +%else %bcond_without test %endif Name: re2 @@ -32,7 +33,7 @@ URL: https://github.com/google/re2 Source0: %{url}/archive/%{longver}/%{name}-%{longver}.tar.gz Source99: baselibs.conf -BuildRequires: cmake +BuildRequires: cmake >= 3.10.2 %if %{?suse_version} < 1550 BuildRequires: gcc11-c++ %else ++++++ re2-2022-04-01.tar.gz -> re2-2022-06-01.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-04-01/.github/workflows/ci.yml new/re2-2022-06-01/.github/workflows/ci.yml --- old/re2-2022-04-01/.github/workflows/ci.yml 2022-03-30 20:41:25.000000000 +0200 +++ new/re2-2022-06-01/.github/workflows/ci.yml 2022-05-10 13:02:12.000000000 +0200 @@ -47,7 +47,7 @@ strategy: fail-fast: false matrix: - ver: [6, 7, 8, 9, 10, 11] + ver: [6, 7, 8, 9, 10, 11, 12] env: CC: gcc CXX: g++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-04-01/CMakeLists.txt new/re2-2022-06-01/CMakeLists.txt --- old/re2-2022-04-01/CMakeLists.txt 2022-03-30 20:41:25.000000000 +0200 +++ new/re2-2022-06-01/CMakeLists.txt 2022-05-10 13:02:12.000000000 +0200 @@ -2,20 +2,14 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -# Old enough to support Ubuntu Xenial. -cmake_minimum_required(VERSION 3.5.1) +# Old enough to support Ubuntu Bionic. +cmake_minimum_required(VERSION 3.10.2) project(RE2 CXX) include(CMakePackageConfigHelpers) include(CTest) include(GNUInstallDirs) -# Unlike GCC and upstream Clang, AppleClang still defaults to `-std=c++98` -# for some reason. Set CMAKE_CXX_STANDARD if we seem to need to set it. :/ -if(APPLE AND NOT CMAKE_CXX_FLAGS MATCHES "-std=" AND NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) -endif() - option(BUILD_SHARED_LIBS "build shared libraries" OFF) option(USEPCRE "use PCRE in tests and benchmarks" OFF) @@ -84,6 +78,7 @@ ) add_library(re2 ${RE2_SOURCES}) +target_compile_features(re2 PUBLIC cxx_std_11) target_include_directories(re2 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) set_target_properties(re2 PROPERTIES SOVERSION ${SONAME} VERSION ${SONAME}.0.0) add_library(re2::re2 ALIAS re2) @@ -105,6 +100,7 @@ ) add_library(testing STATIC ${TESTING_SOURCES}) + target_compile_features(testing PUBLIC cxx_std_11) target_link_libraries(testing PUBLIC re2) set(TEST_TARGETS @@ -137,12 +133,14 @@ foreach(target ${TEST_TARGETS}) add_executable(${target} re2/testing/${target}.cc util/test.cc) + target_compile_features(${target} PUBLIC cxx_std_11) target_link_libraries(${target} testing ${EXTRA_TARGET_LINK_LIBRARIES}) add_test(NAME ${target} COMMAND ${target}) endforeach() foreach(target ${BENCHMARK_TARGETS}) add_executable(${target} re2/testing/${target}.cc util/benchmark.cc) + target_compile_features(${target} PUBLIC cxx_std_11) target_link_libraries(${target} testing ${EXTRA_TARGET_LINK_LIBRARIES}) endforeach() endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-04-01/re2/prefilter_tree.cc new/re2-2022-06-01/re2/prefilter_tree.cc --- old/re2-2022-04-01/re2/prefilter_tree.cc 2022-03-30 20:41:25.000000000 +0200 +++ new/re2-2022-06-01/re2/prefilter_tree.cc 2022-05-10 13:02:12.000000000 +0200 @@ -6,6 +6,7 @@ #include <stddef.h> #include <algorithm> +#include <cmath> #include <map> #include <memory> #include <string> @@ -65,33 +66,6 @@ NodeMap nodes; AssignUniqueIds(&nodes, atom_vec); - - // Identify nodes that are too common among prefilters and are - // triggering too many parents. Then get rid of them if possible. - // Note that getting rid of a prefilter node simply means they are - // no longer necessary for their parent to trigger; that is, we do - // not miss out on any regexps triggering by getting rid of a - // prefilter node. - for (size_t i = 0; i < entries_.size(); i++) { - std::vector<int>& parents = entries_[i].parents; - if (parents.size() > 8) { - // This one triggers too many things. If all the parents are AND - // nodes and have other things guarding them, then get rid of - // this trigger. TODO(vsri): Adjust the threshold appropriately, - // make it a function of total number of nodes? - bool have_other_guard = true; - for (int parent : parents) { - have_other_guard = have_other_guard && - (entries_[parent].propagate_up_at_count > 1); - } - if (have_other_guard) { - for (int parent : parents) - entries_[parent].propagate_up_at_count -= 1; - parents.clear(); // Forget the parents - } - } - } - if (ExtraDebug) PrintDebugInfo(&nodes); } @@ -215,12 +189,9 @@ Prefilter* prefilter = v[i]; if (prefilter == NULL) continue; - if (CanonicalNode(nodes, prefilter) != prefilter) continue; - int id = prefilter->unique_id(); - switch (prefilter->op()) { default: LOG(DFATAL) << "Unexpected op: " << prefilter->op(); @@ -261,6 +232,52 @@ Entry* entry = &entries_[id]; entry->regexps.push_back(static_cast<int>(i)); } + + // Lastly, using probability-based heuristics, we identify nodes + // that trigger too many parents and then we try to prune edges. + // We use logarithms below to avoid the likelihood of underflow. + double log_num_regexps = std::log(prefilter_vec_.size() - unfiltered_.size()); + // Hoisted this above the loop so that we don't thrash the heap. + std::vector<std::pair<size_t, int>> entries_by_num_edges; + for (int i = static_cast<int>(v.size()) - 1; i >= 0; i--) { + Prefilter* prefilter = v[i]; + // Pruning applies only to AND nodes because it "just" reduces + // precision; applied to OR nodes, it would break correctness. + if (prefilter == NULL || prefilter->op() != Prefilter::AND) + continue; + if (CanonicalNode(nodes, prefilter) != prefilter) + continue; + int id = prefilter->unique_id(); + + // Sort the current node's children by the numbers of parents. + entries_by_num_edges.clear(); + for (size_t j = 0; j < prefilter->subs()->size(); j++) { + int child_id = (*prefilter->subs())[j]->unique_id(); + const std::vector<int>& parents = entries_[child_id].parents; + entries_by_num_edges.emplace_back(parents.size(), child_id); + } + std::stable_sort(entries_by_num_edges.begin(), entries_by_num_edges.end()); + + // A running estimate of how many regexps will be triggered by + // pruning the remaining children's edges to the current node. + // Our nominal target is one, so the threshold is log(1) == 0; + // pruning occurs iff the child has more than nine edges left. + double log_num_triggered = log_num_regexps; + for (const auto& pair : entries_by_num_edges) { + int child_id = pair.second; + std::vector<int>& parents = entries_[child_id].parents; + if (log_num_triggered > 0.) { + log_num_triggered += std::log(parents.size()); + log_num_triggered -= log_num_regexps; + } else if (parents.size() > 9) { + auto it = std::find(parents.begin(), parents.end(), id); + if (it != parents.end()) { + parents.erase(it); + entries_[id].propagate_up_at_count--; + } + } + } + } } // Functions for triggering during search.