If you want to compare these 2 printing methods, do it yourself - removing << "\n" from "Hello cout" << "\n" reduces the number of assembly commands from 10 to 4, just 1 more than with printf, and puts is in face just 2 assembly commands - 1 less than printf.
Weird, I get 40 vs 41 lines (not instructions) with your code vs the previous post with "-O6" option.
If you want to compare these 2 printing methods, do it yourself - removing
<< "\n"
from"Hello cout" << "\n"
reduces the number of assembly commands from 10 to 4, just 1 more than withprintf
, andputs
is in face just 2 assembly commands - 1 less thanprintf
.This is not the most efficient option.
This is the most efficient solution.