Why is plotting with GR faster when using GR_jll and @ccall
directly? @jheinen
using GR_jll
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.0 (2021-03-24)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> @time begin
@time using GR_jll
x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]; y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7]
gr = :libgr
@time @ccall gr.gr_polyline(6::Cint, pointer(x)::Ptr{Float64}, pointer(y)::Ptr{Float64})::Nothing
@time @ccall gr.gr_axes(0.2::Float64, 0.2::Float64, 0::Float64, 0::Float64, 1::Cint, 1::Cint, (-0.01)::Float64)::Nothing
@time @ccall gr.gr_updatews()::Nothing
end
0.681576 seconds (292.18 k allocations: 19.435 MiB, 0.77% gc time, 0.48% compilation time) # using GR_jll
GKS: file open error (/workspace/destdir\FONTS\GKSFONT.DAT)
open: No such file or directory
0.033260 seconds (3.92 k allocations: 223.016 KiB, 30.53% compilation time) # gr.gr_polyline
0.013906 seconds (3.53 k allocations: 203.047 KiB, 63.91% compilation time) # gr.gr_axes
0.000004 seconds (6 allocations: 192 bytes) # gr.gr_updatews
0.803224 seconds (416.77 k allocations: 27.419 MiB, 0.66% gc time, 2.78% compilation time) # begin ... end
versus
using GR
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.6.0 (2021-03-24)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> @time begin
@time using GR
x = [0, 0.2, 0.4, 0.6, 0.8, 1.0]; y = [0.3, 0.5, 0.4, 0.2, 0.6, 0.7]
gr = :libgr
@time @ccall gr.gr_polyline(6::Cint, pointer(x)::Ptr{Float64}, pointer(y)::Ptr{Float64})::Nothing
@time @ccall gr.gr_axes(0.2::Float64, 0.2::Float64, 0::Float64, 0::Float64, 1::Cint, 1::Cint, (-0.01)::Float64)::Nothing
@time @ccall gr.gr_updatews()::Nothing
end
0.237283 seconds (63.35 k allocations: 5.483 MiB, 1.55% compilation time) # using GR
2.321641 seconds (3.92 k allocations: 223.016 KiB, 0.46% compilation time) # gr.gr_polyline
0.007653 seconds (3.53 k allocations: 203.047 KiB, 98.55% compilation time) # gr.gr_axes
0.000056 seconds (6 allocations: 192 bytes) # gr.gr_updatews
2.638014 seconds (187.92 k allocations: 13.304 MiB, 0.83% compilation time) # begin... end
julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)