Skip to content

Commit

Permalink
more conservative bloom
Browse files Browse the repository at this point in the history
  • Loading branch information
dg-pb committed Jun 6, 2024
1 parent 6c9dbc3 commit 1b9bdc9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Objects/stringlib/fastsearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ STRINGLIB(horspool_find)(const STRINGLIB_CHAR* s, Py_ssize_t n,
unsigned long mask = 0;
Py_ssize_t true_gap = 0;
Py_ssize_t j_stop = m;
if (n >= 10 * m) {
if (n >= 30 * m) {
j_stop = m_m1;
true_gap = m;
// Note: true_gap("___aa") = 1
Expand Down Expand Up @@ -863,9 +863,8 @@ STRINGLIB(horspool_find)(const STRINGLIB_CHAR* s, Py_ssize_t n,
j_off = ip - p_end;
for (j = 0; j < j_stop; j++) {
ihits++;
LOG("a: %c\n", ss[j_off + jp]);
LOG("b: %c\n", p[jp]);
jp = p_stt + (reversed ? -j : j);
LOG("Checking %c <?> %c ?\n", ss[j_off + jp], p[jp]);
if (ss[j_off + jp] != p[jp]) {
break;
}
Expand Down Expand Up @@ -903,6 +902,7 @@ STRINGLIB(horspool_find)(const STRINGLIB_CHAR* s, Py_ssize_t n,
(double)ihits * hrs_hcost) / (double)i * ll;
exp_twy = twy_icost + ll * twy_lcost;
if (exp_twy < exp_hrs) {
LOG("switching to two-way algorithm: n=%ld, m=%ld\n", n, m);
STRINGLIB(_init_critical_fac)(&pw, dir);
Py_ssize_t res;
if (reversed) {
Expand Down

0 comments on commit 1b9bdc9

Please sign in to comment.