I just did a crude test of string test method comparisons:
10000000 iterations of 'strTestString = ""' completed in 78ms
10000000 iterations of 'strTestString.Length > 0' completed in 62ms
10000000 iterations of 'strTestString.Equals(String.Empty)' completed in 140ms
10000000 iterations of 'strTestString = String.Empty' completed in 328ms
I had to keep increasing the test count till I finally saw some results... started at about 10 million repeats. Given that, I think the method one uses for testing strings is really negligable compared of all the other things one can do to streamline a .NET application.
<opinion>
With the speed of computers, and the strength and speed of the .NET framework, it's probably a much better investment of time and money to study good design techniques. Poor design will have a much larger impact on everything than the nuances of syntax variations.
</opinion>
|