I encode a solver that must write several numbers to a file at each time step. The time step should be small, so I need to write the output often.
This figure shows code profiling . As you can see, the selected I / O area takes up a significant portion of the execution time.
IO runs as
println(out_file, t, " ", v.P[1], " ", v.P[end])
where I want to save the first and last element of the vector Pinside the data structure v, as well as the value t.
From profiling, it seems that most of the computational time is occupied by a function string.jl(which is not defined by me).
This makes you wonder if there is a more efficient way to write iterative output to a file.
Any suggestion?
thank
Additional Information
.
, , -
out_file = open("file.out", "w")
delta_t = computeDeltaT()
t = 0
while t<T
P = computeP()
println(out_file, t, " ", P[1], " ", P[end])
delta_t = computeDeltaT()
t += delta_t
end
close(out_file)
, , , delta_t. P. , , , 5.
@isebarn 100 . -, .