4 ms·
That depends entirely on the regex implementation. If the implementation uses a DFA to match multiple regexes simultaneously then the performance will be as goo
by jules 10y ago
That depends entirely on the regex implementation. If the implementation uses a DFA to match multiple regexes simultaneously then the performance will be as good as a trie because a DFA is more or less a trie.
- vanderZwan 10y ago> That depends entirely on the regex implementation True, and anyone who knows that Russ Cox is a core member of the Go team will have a hard time suppressing a smirk when reading this :) https://swtch.com/~rsc/regexp/ https://swtch.com/~rsc/regexp/
- laumars 10y agoTrue. I was talking specifically about the same Regexp package as the one used in the topic project though. I assumed that would have been obvious given the context however I apologise for not stating that in my comment and shall amend it appropriately. [edit: i can't add an amendment to my previous post now]
- mypalmike 10y agoTrue. But nowadays most regex implementations are quite good (apparently go's is not - I haven't used it). That said, most regex performance problems are PEBKAC. Writing a fast regex is hard and requires a pretty thorough understanding of parser theory. And many who use regexes don't understand that it's critical to precompile them for performance. You don't get a fast parser when you rebuild the DFA each time you use it. *edit: a word