3 ms·
In the performance category, it imposes a cost on string searches, also, unless you know the string length via some other mechanism. Algorithms like Boyer-Moore
by _delirium 15y ago
In the performance category, it imposes a cost on string searches, also, unless you know the string length via some other mechanism. Algorithms like Boyer-Moore get their speed by skipping over some characters, but with null-terminated strings it's unsafe to skip any character without first checking if it's null. Granted, that's mostly a cost imposed on long strings being searched for longish substrings.
- alnayyir 15y agoThe case you described as having the cost imposed is literally what boyer-moore excels at, so it doesn't even have the benefit of hurting the pathological case.