refactor(julials): update docs & remove unused shell scripts
This commit is contained in:
parent
ad4a9f53a1
commit
f5efb7cb66
5 changed files with 23 additions and 40 deletions
|
@ -1,27 +1,24 @@
|
|||
# How to manage Julia Language Server
|
||||
This config use sysimage built with PackageCompiler to make language server startup faster.
|
||||
Scripts in this directory is for management of sysimage.
|
||||
This config use sysimage built with PackageCompiler to make language server starts faster.
|
||||
Scripts in this directory are for management of the sysimage.
|
||||
|
||||
# description
|
||||
all related process is done in project at `~/.julia/environments/nvim-lspconfig/`.
|
||||
|
||||
## startup
|
||||
## install (or minor update of Julia)
|
||||
```sh
|
||||
$ ./setup_julials.sh
|
||||
julia ./setup_julials.jl
|
||||
```
|
||||
which executes `add_dependencies.jl` internally.
|
||||
Run Language Server with `--tracecompile` option from any editor.
|
||||
|
||||
## update
|
||||
```sh
|
||||
$ ./update_julials.sh
|
||||
julia ./update_julials.sh
|
||||
```
|
||||
which updates project, compile sysimage, then do precompile.
|
||||
To use the sysimage, run Language Server with `-J ~/.julia/environments/nvim-lspconfig/` option.
|
||||
|
||||
# effect
|
||||
Start up got about x3 - x4 faster.
|
||||
It still takes some time to load packages though.
|
||||
|
||||
# TODO
|
||||
- [ ] Not sure all necessary packages are listed in add_dependencies.jl
|
||||
- [ ] Maybe it's better to set up different sysimages for each projects
|
||||
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
#!/usr/bin/julia
|
||||
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
|
||||
if !ispath(project_path)
|
||||
try
|
||||
mkdir(project_path)
|
||||
@info "Created $(project_path)"
|
||||
touch(joinpath(project_path, "tracecompile.jl"))
|
||||
catch e
|
||||
@error e
|
||||
@error dump(e)
|
||||
throw(e)
|
||||
end
|
||||
mkdir(project_path)
|
||||
@info "Created $(project_path)"
|
||||
touch(joinpath(project_path, "tracecompile.jl"))
|
||||
end
|
||||
cmd = `julia --project=$(project_path) $(@__DIR__)/add_dependencies.jl`
|
||||
@info cmd
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/bash -x
|
||||
julia --project=~/.julia/environments/nvim-lspconfig ./add_dependencies.jl
|
|
@ -1,15 +1,16 @@
|
|||
#!/usr/bin/julia
|
||||
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
|
||||
cd(project_path)
|
||||
@info "now at " pwd()
|
||||
run(`julia --project=. -e 'using Pkg; Pkg.update()'`)
|
||||
compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line
|
||||
# Remove anonymous functions from compile trace
|
||||
!startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", line)
|
||||
end |> join
|
||||
read("precompile_exec_head.jl", String) * compile_traces |> (b -> write("precompile_exec.jl", b))
|
||||
@info "compiling sysimage..."
|
||||
run(`julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'`)
|
||||
@info "post precompile"
|
||||
run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`)
|
||||
cd(project_path) do
|
||||
@info "now at " pwd()
|
||||
run(`julia --project=. -e 'using Pkg; Pkg.update()'`)
|
||||
compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line
|
||||
# Remove anonymous functions from compile trace
|
||||
!startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", line)
|
||||
end |> join
|
||||
read("precompile_exec_head.jl", String) * compile_traces |> (b -> write("precompile_exec.jl", b))
|
||||
@info "compiling sysimage..."
|
||||
run(`julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'`)
|
||||
@info "post precompile"
|
||||
run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/bash -x
|
||||
cd ~/.julia/environments/nvim-lspconfig/ || return 1
|
||||
julia --project=. -e 'using Pkg; Pkg.update()'
|
||||
cat precompile_exec_head.jl tracecompile.jl > precompile_exec.jl
|
||||
julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path="sys-ls.so", precompile_execution_file=["precompile_exec.jl"])'
|
||||
julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'
|
||||
|
Loading…
Reference in a new issue