fredrikekre / Runic.jl

A code formatter for Julia with rules set in stone.
MIT License
92 stars 2 forks source link

feat(script): Add PrecompileTools.jl pass to make the script more user friendly. #19

Closed Klafyvel closed 1 month ago

Klafyvel commented 1 month ago

Hi! I played with Runic.jl this afternoon and loved its simplicity of use. I don't know if you already accept contributions to this package but if you do, here's a simple change that makes it a bit smoother for the user. It simply adds a PrecompileTools.jl pass that fires the main function.

Before change:

$ time runic --help
...
julia -e 'using Runic; exit(Runic.main(ARGS))' -- --help  5.14s user 0.15s system 101% cpu 5.215 total

After:

$ time runic --help
...
julia -e 'using Runic; exit(Runic.main(ARGS))' -- --help  0.24s user 0.15s system 129% cpu 0.301 total
fredrikekre commented 1 month ago

Thanks, I have some precompilation locally that I just haven't commited just yet.

I played around with PrecompileTools.jl but with from my testing adding

precompile(main, (Vector{String},))

seems to be equally effective for me at least.

fredrikekre commented 1 month ago

I commited the patch I had locally to the master branch. Can you double check whether you think that is sufficient or if the more elaborate setup from this PR is needed?

Klafyvel commented 1 month ago

Hi, I think your modification does the job. :)

$ time runic --help
julia -e 'using Runic; exit(Runic.main(ARGS))' -- --help  0.44s user 0.22s system 115% cpu 0.569 total
fredrikekre commented 1 month ago

Thanks for the PR and for trying out Runic!