Better HN
topnewbestaskshowjobs
Log inSign up

jo3_l

3 karma · joined Sep 11, 2026 (2mo ago) · 2 submissions

Submissions

1.

Nuking stats problems with a probabilistic programming language(jo3-l.dev ↗)

3 points · by jo3_l · 1mo ago · discuss

comment 2mo ago · link · parent

(OP here.) You're correct that for short patterns there's little advantage over the brute-force algorithm, and in fact the brute-force algorithm should actually be faster in many cases. Indeed the per-iteration comparison against the pattern in the brute-force algorithm is essentially a memcmp, which is vectorized and runs very fast on modern hardware. Consequently all mainstream programming languages that I know of just use the brute-force algorithm as a fallback when the pattern is short, as opposed to something more complicated like bitap.

I tried to be fairly careful to not overstate the performance benefits in the original post for this reason.