💾 Archived View for heavysquare.com › notes › FFEC-reasoning-on-regular-expressions.txt captured on 2022-04-29 at 11:17:10.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
~~ 2021-01-30T19:12:31+01:00 Writing regular expressions is kinda easy, it's all over the place in comp sci education. Reasoning about a match statement's performance is not easy though. But also, regular expressions are so declarative that they oftentimes used in declarative environments, like filters, build files. Spotted in a pom.xml: "x.*foobar.*x" was really slow.. Reasoning was something like that the first greedy '.*' takes the whole thing at first and then checks if there's foobar somewhere to be found. Then if not, it takes a bit less.. greedily.. etc. For extra color, this was in a log filter, so prod logging suffered big time. ~~ 2021-03-05T16:34:48+01:00 I was not able to reproduce this with grep.. At the time of this writing.