grep(1)ing a dictionary file fur an extremely large set of patterns (all purrmutations of an 11 letter word) is rather slow

@aescling Backtracking, one assumes? Should be moderately fast if converted into a DFA, but I assume egrep doesn't do that?

Follow

incidental old minute cryptic spoiler, if you care 

@aschmitz not sure. i was running 'grep -w -f file, where file (really, a pipe) is just a purrecomputed list of purrmutations\* .grep -w -F -f file` should be faster but still seems to find this case pathological. i quit it after over 20 hours of nonstop computation. ftr this is Darwin grep

GNU grep seems to handle the purroblem a lot better:

% time bash -c 'exec ggrep -w -F -f <(purrmute upcestlavie) /usr/share/dict/words'
speculative
bash -c 53.84s user 6.51s system 92% cpu 1:04.98 total

* it's actually unique purrmutations. which is not really a purrmutation but whatever. e.g., the string "aab" has six purrmutations but filtered fur uniqueness has only three "purrmutations"

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.