Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • I haven't tried to compile it with optimizations, because it wasn't the purpose. I just wanted to be sure why the second code is much faster. Commented Feb 14, 2010 at 15:39
  • Why would you expect it to remove the new[]/delete[] loop? Optimizing out a call to a function with external linkage (and side effects) sounds like a dangerous thing to do. Commented Feb 14, 2010 at 18:23
  • It is not a function - just a loop that obviously does nothing. Commented Feb 14, 2010 at 19:40
  • Technically, new indeed is not a function, but it does call one. bk1e incorrectly assumes that function has side effects. A non-default one could, but that makes the entire timing meaningless. Commented Feb 15, 2010 at 12:35