Writing to CSV files and plotting are getting slower in every run

I am not an expert in programming, but I think compile time for CSV writing is defined with “define_reporting” in the code below:

using JuMP, PyPlot, DataFrames, CSV, Gurobi, Missings, PyCall, Statistics, TimerOutputs # Importing required packages

const to = TimerOutput()
@timeit to "define_figcreation" include("CreateBarLine.jl")
@timeit to "define_optimization" include("ExpansionModel.jl")
@timeit to "define_fixmodel" include("FixModel.jl")
@timeit to "define_stackcreation" include("ProcessDispatch.jl")
@timeit to "define_inputs" include("ReadFiles.jl")
@timeit to "define_reporting" include("RecordCSV.jl")
@timeit to "define_plotting" include("RecordPlot.jl")
@timeit to "define_sets" include("SetCreation.jl")

@timeit to "build_model_solve_model_report_results" ExpansionModel()

show(to)

Run time for CSV writing is defined with “write_to_CSV” in the code below:

function ExpansionModel()

    @timeit to "build_model" begin
              My model here...
    end

    @timeit to "solve_model" begin optimize!(Expansion_Model) end

    @timeit to "report_results" begin
            @timeit to "write_to_CSV" begin RecordCSV(some inputs here...) end
            RecordPlot(some inputs here...)
    end
end

So, in the screen shots I shared, “write_to_CSV” is run time, not compile time.