Skip to content

Comment on Parsing Text with Nomparent

Comments

Yes, there are crazy optimizations in the regex crate. :-)

But it almost certainly depends on what you're doing. If you're using Nom, you're probably performing a parsing task. A regex might be faster there, but maybe not by too much, depending. If you're doing a searching task though, perhaps where there are few matches relative to the size of the haystack, then it's quite plausible that the regex will go a lot more than 3x as fast as Nom.

In any case, I'm not sure if Haskell is comparable. I'm not sure that any Haskell native regex engine is really known for its speed, although I haven't done any sort of comprehensive benchmarking.

There are other considerations. A parser written with Nom might be easier to read and/or manipulate than a parser written with regex. But even there, it depends.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.