If there are big differences in where you don't expect them (e.g. printf in a for loop being very slow), then it usually is a difference in implementation and possibly contract. E.g. I wouldn't be surprised if println! in Rust is synchronous, which tends to be slow on both terminals and redirections (i.e. file I/O).
For these simple examples an strace may be enlightening in this regard.
Edit: Indeed this seems to be the case from the library source code (println! -> _eprint -> stdout -> LineWriter).