Skip to content

Instantly share code, notes, and snippets.

@aplavin
Last active January 27, 2023 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aplavin/3f8490c7b944da86f9f1271c8cefaa7e to your computer and use it in GitHub Desktop.
Save aplavin/3f8490c7b944da86f9f1271c8cefaa7e to your computer and use it in GitHub Desktop.
code = """
import Pkg
@showtime Pkg.instantiate()
@showtime Pkg.precompile()
@showtime using Tables, StructArrays, CSV, FlexiGroups
@showtime tbl = CSV.read(IOBuffer("a,b,c\n1,2.0,abc"), columntable) |> StructArray
@showtime groupmap(x -> x.a, length, tbl)
"""
projecttoml = """
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
FlexiGroups = "1e56b746-2900-429a-8028-5ec1f00612ec"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
"""
for jl in [`julia`, `julia-19`]
@info "" jl ver=read(`$jl -E 'VERSION'`, String) |> strip
mktempdir() do depot
mkdir(joinpath(depot, "registries"))
cp(expanduser("~/.julia/registries/General"), joinpath(depot, "registries/General"))
# alternatively:
# run(addenv(`$jl -e 'using Pkg; pkg"registry add https://github.com/JuliaRegistries/General"'`, Dict("JULIA_DEPOT_PATH" => depot)))
for (i, date) in enumerate(["2023-01-01", "2023-01-10", "2023-01-20"])
cd(joinpath(depot, "registries/General")) do
commit = read(`git rev-list -n 1 --first-parent --before=$date master`, String) |> strip
run(`git checkout $commit`)
end
mktempdir() do env
cd(env)
write("Project.toml", projecttoml)
write("script.jl", code)
# if i == 1
# @info "Initial run in depot"
# run(addenv(`$jl --project script.jl`, Dict("JULIA_DEPOT_PATH" => depot)))
# end
@info "$i-th run in depot"
run(addenv(`$jl --project script.jl`, Dict("JULIA_DEPOT_PATH" => depot)))
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment