2009
03.28

Yesterday, I spent 2 hours to rewrite one parser code that my report wrote. The goal was to see if the parser could perform better while the code looks more organized and simpler to follow. For every text process, I tend to use the regular expression because of the simplicity and cleanness it provides, but I was not 100% sure if it could overcome the performance issue as Managed Code is known to be slow in many aspects.

The first attempt was disaster as it took probably 2 or 3 times more to process the same amount of data. While I was reading the code again before I gave up, I realized one mistake and one thing that I forgot. Regular expression in .NET is slow by default during run-time unless a specific option is specified during initialization – RegexOptions.Compiled.

http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions.aspx

Also here is a good MSDN article about the improving the performance of the base library.

http://msdn.microsoft.com/en-us/magazine/cc163670.aspx

No Comment.

Add Your Comment