[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/minrx, updated. gawk-4.1.0-5923-g8cf5f867
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/minrx, updated. gawk-4.1.0-5923-g8cf5f867 |
Date: |
Tue, 28 Jan 2025 07:50:43 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/minrx has been updated
via 8cf5f86770ac91ed423c21abde5a1948d0925b04 (commit)
from 832ce4bf9ee845aa3f3aa80d4e74100ecb62b14e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=8cf5f86770ac91ed423c21abde5a1948d0925b04
commit 8cf5f86770ac91ed423c21abde5a1948d0925b04
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Jan 28 14:50:27 2025 +0200
Update minrx.cpp.
diff --git a/support/ChangeLog b/support/ChangeLog
index 9ee01ac6..f6a8df57 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,7 @@
+2025-01-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * minrx.cpp: Update again. More speedups.
+
2025-01-27 Arnold D. Robbins <arnold@skeeve.com>
* minrx.cpp: Update again. More speedups.
diff --git a/support/minrx.cpp b/support/minrx.cpp
index dd9d0df0..319eb895 100644
--- a/support/minrx.cpp
+++ b/support/minrx.cpp
@@ -52,6 +52,12 @@
#endif
#include "minrx.h"
+#ifdef __GNUC__
+#define INLINE __attribute__((__always_inline__)) inline
+#else
+#define INLINE inline
+#endif
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
@@ -67,9 +73,9 @@
namespace MinRX {
-template <typename UINT> inline auto ctz(UINT x) { return __builtin_ctz(x); }
-template <> inline auto ctz(unsigned long x) { return __builtin_ctzl(x); }
-template <> inline auto ctz(unsigned long long x) { return __builtin_ctzll(x);
}
+template <typename UINT> auto ctz(UINT x) { return __builtin_ctz(x); }
+template <> auto ctz(unsigned long x) { return __builtin_ctzl(x); }
+template <> auto ctz(unsigned long long x) { return __builtin_ctzll(x); }
template <typename TYPE, TYPE INIT = 0>
struct COWVec {
@@ -172,15 +178,6 @@ struct COWVec {
(*storage)[idx] = val;
return *this;
}
- COWVec &sub(std::size_t idx, TYPE val) {
- if (storage->refcnt > 1) {
- --storage->refcnt;
- storage = storage->clone();
- storage->refcnt = 1;
- }
- (*storage)[idx] -= val;
- return *this;
- }
};
template <typename UINT>
@@ -198,7 +195,7 @@ struct QSet {
bits[0][0] = 0;
}
~QSet() { ::operator delete(bits[0]); }
- inline static std::uint64_t bit(UINT k) { return (std::uint64_t) 1 <<
(k & 0x3F); }
+ static std::uint64_t bit(UINT k) { return (std::uint64_t) 1 << (k &
0x3F); }
bool empty() const { return !bits[0][0]; }
bool contains(UINT k) const {
int i = 0, s = 6 * depth;
@@ -686,9 +683,6 @@ struct CSet {
std::pair<std::optional<const std::array<bool, 256>>,
std::optional<char>>
firstbytes(WConv::Encoding e) const {
std::array<bool, 256> fb = {};
-#ifdef ROARING
- roaring_uint32_iterator_t *i;
-#endif
auto firstunique = [](const std::array<bool, 256> &fb) ->
std::optional<char> {
int n = 0, u = -1;
for (int i = 0; i < 256; ++i)
@@ -698,16 +692,6 @@ struct CSet {
};
switch (e) {
case WConv::Encoding::Byte:
-#ifdef ROARING
- i = roaring_iterator_create(bitmap);
- while (i->has_value) {
- if (i->current_value > 255)
- break;
- fb[i->current_value] = true;
- roaring_uint32_iterator_advance(i);
- }
- roaring_uint32_iterator_free(i);
-#else
for (const auto &r : ranges) {
if (r.min > 255)
break;
@@ -715,23 +699,13 @@ struct CSet {
for (auto b = lo; b <= hi; b++)
fb[b] = true;
}
-#endif
return {fb, firstunique(fb)};
case WConv::Encoding::UTF8:
-#ifdef ROARING
- i = roaring_iterator_create(bitmap);
- while (i->has_value) {
- fb[utfprefix(i->current_value)] = true;
- roaring_uint32_iterator_advance(i);
- }
- roaring_uint32_iterator_free(i);
-#else
for (const auto &r : ranges) {
auto lo = utfprefix(r.min), hi =
utfprefix(r.max);
for (auto b = lo; b <= hi; b++)
fb[b] = true;
}
-#endif
return {fb, firstunique(fb)};
default:
return {{}, {}};
@@ -1271,6 +1245,7 @@ struct Execute {
const Node *nodes = r.nodes.data();
Execute(const Regexp &r, minrx_regexec_flags_t flags, const char *bp,
const char *ep) : r(r), flags(flags), wconv(r.enc, bp, ep) {}
template <typename... XArgs>
+ INLINE
void add(QVec<NInt, NState> &ncsv, NInt k, NInt nstk, const NState &ns,
WChar wcnext, XArgs... xargs) {
const Node &n = nodes[k];
if (n.type <= Node::CSet) {
@@ -1475,7 +1450,7 @@ struct Execute {
auto [n, ns] = mcsvs[0].remove();
add(mcsvs[1], n + 1, nodes[n].nstk, ns, wcnext);
}
- if (!best.has_value() && (!r.firstcset.has_value() ||
r.firstcset->test(wcnext))) {
+ if (!best.has_value() && (!r.firstbytes.has_value() ||
(wcnext != WConv::End && (*r.firstbytes)[(unsigned char) *wconv.cp]))) {
nsinit.boff = wconv.off();
add(mcsvs[1], 0, 0, nsinit, wcnext);
}
@@ -1495,7 +1470,7 @@ struct Execute {
auto [n, ns] = mcsvs[1].remove();
add(mcsvs[0], n + 1, nodes[n].nstk, ns, wcnext);
}
- if (!best.has_value() && (!r.firstcset.has_value() ||
r.firstcset->test(wcnext))) {
+ if (!best.has_value() && (!r.firstbytes.has_value() ||
(wcnext != WConv::End && (*r.firstbytes)[(unsigned char) *wconv.cp]))) {
nsinit.boff = wconv.off();
add(mcsvs[0], 0, 0, nsinit, wcnext);
}
-----------------------------------------------------------------------
Summary of changes:
support/ChangeLog | 4 ++++
support/minrx.cpp | 51 +++++++++++++--------------------------------------
2 files changed, 17 insertions(+), 38 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/minrx, updated. gawk-4.1.0-5923-g8cf5f867,
Arnold Robbins <=