Improve Performance of char.IsWhiteSpace for ASCII inputs in .NET 3.5

Posted by Tanzim Saqib on ASP.net Weblogs See other posts from ASP.net Weblogs or by Tanzim Saqib
Published on Sun, 04 Apr 2010 14:18:00 GMT Indexed on 2010/04/04 14:23 UTC
Read the original article Hit count: 369

Filed under:
IsNullOrWhiteSpace is a new method introduced in string class in .NET 4.0. While this is a very useful method in string based processing, I attempted to implement it in .NET 3.5 using char.IsWhiteSpace() . I have found significant performance penalty using this method which I replaced later on, with my version. The following code takes about 20.6074219 seconds in my machine whereas my implementation of char.IsWhiteSpace takes about 1/4 less time 15.8271485 seconds only. In many scenarios ex. string...(read more)

© ASP.net Weblogs or respective owner

Related posts about c#