Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try precompilation for faster TTFP #56

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Expand All @@ -41,6 +42,7 @@ Markdown = "1.9"
Pkg = "1.9"
PlotlyBase = "0.8"
PlotlyKaleido = "2"
PrecompileTools = "1.2.1"
Reexport = "1"
ScopedValues = "1.2.1"
Scratch = "1"
Expand Down
16 changes: 15 additions & 1 deletion src/PlutoPlotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using Markdown
using Downloads: download
using Artifacts
using ScopedValues
using PrecompileTools
# This is similar to `@reexport` but does not exports undefined names and can
# also avoid exporting the module name
function re_export(m::Module; skip_modname = false)
Expand Down Expand Up @@ -49,10 +50,23 @@ include("show.jl")
# Forward methods of PlotlyBase to support PlutoPlot objects
include("plotlybase_forward.jl")

function __init__()
# function __init__()
# if !is_inside_pluto()
# @warn "You loaded this package outside of Pluto, this is not the intended behavior and you should use either PlotlyBase or PlotlyJS directly.\nNOTE: If you receive this warning during pre-compilation or sysimage creation, you can ignore this warning."
# end
# end

@compile_workload begin
data = [
scatter(;y = rand(10)),
scattergeo(;lat = rand(10), lon = rand(10)),
heatmap(;z = rand(10,10)),
surface(;z = rand(10,10))
]
layout = Layout(;title = "lol")
p = plot(data, layout)
_show(p)
plot(rand(10,4)) |> _show
end

end
Loading