Recently there was a discussion on one of our internal email aliases in which this problem came up. I though it was an interesting problem so I posed this Quiz to assorted people I work with to see what kinds of things they would say.
Considering these three options:
Option 1:
sw.WriteLine(subject + ": " + message);
Option 2:
sw.WriteLine("{0}: {1}", subject, message);
Option 3:
sw.Write(subject);
sw.Write(": ");
sw.WriteLine(message);
Answer these questions:
Q1. Which of these choices offers the best performance?
Q2: Can you characterize the memory usage of each of these?
Q3: Which would the performance team generally recommend, and why?
Q4: What special factors might alter this recommendation?
Q5: What did you have do assume about "sw" to answer the question?
For answers check the link below:
Link to Rico Mariani's Performance Tidbits : Performance Quiz #1 (of a series?)
No comments:
Post a Comment