logo       

RE: Clean way to do string.join: msg#00208

org.user-groups.dotnet.padnug

Subject: RE: Clean way to do string.join


The difference between the double Append vs Format surprised me as well.
That was why I ran the tests ten times to make sure the first couple runs
were not an anomaly.

Don't get me wrong, I think well-performing applications are important.
Developers these days too often take the "if it's slow we'll throw more
hardware at it" attitude. It's very true that hardware is cheaper than
people these days, so to an extent that works (particularly in server-based
applications like web apps and web services), but we still need to be
cognisant of the realities of the users' environments. We just need to be
equally cognisant of putting our efforts where they will do the most good.
My former co-worker spent three days determining whether Double.TryParse()
vs Double.Parse() and catch the exception vs walk the string
character-by-character was more efficient. In the end, a rough calculation
showed that over the next 20 years of the application running continuously
his efforts would have saved us about a minute of CPU time.

> I think what is more interesting from an academic viewpoint
> is the use of Format() vs. two Appends. The Append().Append()
> is twice as fast as your original, and nearly twice as fast
> as the version that Stuart put forward.
>
> At the end of the day it really comes down to does it work,
> and is it understandable? I doubt that the original poster
> needed anything other than the solution that Craig put forward.






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise