摘要: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?
从 Eric Gunnerson 的blog 链接过去的,原文在这里。
看之前,自己先想想吧,那家伙的问题后面紧跟着他的答案的说,而我不幸是从后往前看的 。
感觉Q1回答起来应该不算困难。后面几个....
呵呵
...[
阅读全文]