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.

Required fields*

10
  • 2
    I would assume the difference in running time is due to the difference between the stdio.h and cstdio header files (and functions implemented therein). Commented Apr 15, 2015 at 6:06
  • 3
    Even though it's a trivial amount of code, and it's mostly I/O anyway, you should still compile with optimisations enabled (e.g. -O3) to get meaningful results. Commented Apr 15, 2015 at 6:07
  • 3
    Repeat your test in alternation a few times and see if the results are consistent of if it was just a cache/timing effect. Commented Apr 15, 2015 at 6:24
  • 4
    How often have you tested this? Commented Apr 15, 2015 at 6:25
  • 5
    -1 for benchmarking without optimizations. That's never a good idea. Also, using lot's of I/O in a benchmark is also not that good. You should generate a random set of numbers first, then time the benchmark code and carefully take care of variables that may be optimized out. Commented Apr 15, 2015 at 6:44