- The performance difference is probably not measurable.
- The
print
function outputs a newline at the end; printf
does not unless requested.
- The
print
code converts the arguments to strings and then sends them to the output separated by the OFS (output field separator).
- The
printf
code might need to convert the string to a double before formatting it using a double format (%16.8g
or something), and similar operations.
- The system call used is going to
write(2)
or something similar for both, but there'll be code (probably <stdio.h>
) layered above that.
All that adds up to:
- The implementations are different;
print
is a little simpler (and therefore faster) than printf
.
- The difference is probably not measurable for most purposes.
- Use
print
if it will do what you need; use printf
when it does what you need.
- Don't worry about it.
And using a sprintf
followed by print
is likely to be slower than using printf
directly, so don't.
In case of doubt, measure.