Hacker News new | past | comments | ask | show | jobs | submit login

Ry's is faster. Ragel does pretty good and it gets you most of the way there when you need something that runs really fast, but it can't beat what a skilled programmer can do to optimize a parser.



> it can't beat what a skilled programmer can do to optimize a parser.

What sorts of clever things does Ry's parser do that Ragel can't figure out?


A sure-fire way to beat a Ragel parser is to look ahead several characters and test the limited possibilities that are present when a language has literal strings like GET and POST. You can essentially fall back to extremely fast string searching algorithms in certain places.

Ragel assumes character-by-character parsing and it's difficult to generate fast code that looks ahead without running into buffer block boundaries. It could be done though.

You can also use character classes to reduce the number of tests. Ragel doesn't try to figure those out.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: