3 ms·
You have the general idea right in that the matching routine itself might completely avoid the regex engine. But that doesn't mean the implementation saves ever
by burntsushi 10y ago
You have the general idea right in that the matching routine itself might completely avoid the regex engine. But that doesn't mean the implementation saves every possible instruction during compilation. For the most part, compilation is assumed to be amortized somehow, so as long as it's reasonable, not much work has gone into making it as fast as possible.
- zokier 10y agoI assume compiling/translating globs to regexp also takes some time. I wonder if that could be meaningful in some pathological cases?
- burntsushi 10y agoIt's meaningful when you can't amortize compilation. I wouldn't call those pathological, but they seem niche. The translation from glob to regex at the syntax level is likely a non-factor. It's the compilation of the regex that probably starts to matter.