Posts

Going harder on the topic of string validation

Image
TL;DR:  Simple string validation code for ASCII characters can be massively faster than Regular Expressions based approaches. Jump tables represent a technique with amazing speed characteristics for string validations in particular and similar problem patterns. When optimizing performance, always include a wide range of sample data to cover best and worst case scenarios! Two days ago, I read an interesting blog post by Maarten Balliauw on "Making string validation faster by not using a regular expression" . The article caught my interest just because it was about performance and that's what generally gets me - waaaay too easily! Anyway, Maarten's blog post finally made me decide to start my own blog (thanks, Maarten!). So you are just looking at my very first blog post. The bottom line of Maarten's blog post was roughly this: While regular expressions quite often seem like an obvious choice and the Swiss army knife for anything that's to do with strings,