# Why can't some functions (CSV.File()) be precompiled?

**URL:** <https://discourse.julialang.org/t/why-cant-some-functions-csv-file-be-precompiled/91851>\
**Category:** General Usage\
**Tags:** precompilation, package-compiler\
**Created:** [December 19, 2022, 1:17pm UTC](https://discourse.julialang.org/t/why-cant-some-functions-csv-file-be-precompiled/91851 "2022-12-19T13:17:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bertulli](https://avatars.discourse-cdn.com/v4/letter/b/ecc23a/32.png) [@bertulli](https://discourse.julialang.org/u/bertulli)\
**Post date:** [December 19, 2022, 1:17pm UTC](https://discourse.julialang.org/t/why-cant-some-functions-csv-file-be-precompiled/91851/1 "2022-12-19T13:17:48Z")

</div>

Hi all!

I’m using `PackageCompiler` to speed up my Julia initialization time. I first run the code I usually run in a session with `--trace-compile=~/Julia/trace-compilation.jl`, then I create the sysimage with

```julia

using PackageCompiler

PackageCompiler.create_sysimage(
    ["CSV", "DataFrames", "Statistics",
     "Unitful", "Plots", "Debugger",
     "StatsPlots", "GLM"];
    precompile_statements_file="/home/alessandro/Julia/trace-compilation.jl",
    sysimage_path="~/Julia/reasonable-sysimage.so"
)

```

However then, when starting Julia with the new sysimage (using `-t 4 -J ~/Julia/reasonable-sysimage.so`), I noticed that some functions, like

```julia
f = open(register_init_csv_file)
register_dataframe = DataFrame(CSV.File(f)) # <---- THIS
register_grouped_df = groupby(register_dataframe, register_sym)
close(f)

```

are still “slow to start”. I think this is because they are not precompiled. However, I can’t understand why. I suppose it’s because the type signature of `CSV.File()` is not known at compile time. May it be? But so, why is it “fast” if I re-evaluate the code (after `touch`ing the file?

Thanks!
