Improving Fortran Results in the Julia Micro-benchmarks

To avoid the transposition, can you use a named-list?

I am asking because I have never used a named-list myself.

Best

Would you like to try this?

subroutine printfd(n)
integer, intent(in) :: n
integer :: i , unit
character(*), parameter :: newline = new_line("")
open(unit=1, file="/dev/null")
write(unit=1, fmt=*) (i, i+1, newline, i=1, n)
close(unit=1)
end subroutine

(Also, the integer::unit variable declaration here is not necessary, maybe it can be removed later)

1 Like

It works great: fortran,print_to_file,9.787620

1 Like

I created an Issue. Could you please submit your great solution there?

1 Like

Does this change the benchmark considering that you’re replacing 10000 write statements with one? E.g. C and Julia programs in the suite don’t do that. It’s possible that the intent of the benchmark was to compare the speed of doing many small writes.

3 Likes