Skip to content

Commit 69d92f7

Browse files
committed
Add precompilation statements for the PythonCall extension
1 parent 9448a41 commit 69d92f7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ext/DimensionalDataPythonCall.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,15 @@ function PythonCall.pyconvert(::Type{DimStack}, x::Py, d=nothing; copy=false)
6161
return DimStack(NamedTuple(arrays); metadata)
6262
end
6363

64+
# Precompile main calls to pyconvert(::DimArray) with copy=true and copy=false
65+
precompile(Tuple{typeof(PythonCall.Core.pyconvert), Type{DimensionalData.DimArray{T, N, D, R, A, Na, Me} where Me where Na where A<:AbstractArray{T, N} where R<:Tuple where D<:Tuple where N where T}, PythonCall.Core.Py})
66+
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:copy,), Tuple{Bool}}, typeof(PythonCall.Core.pyconvert), Type{DimensionalData.DimArray{T, N, D, R, A, Na, Me} where Me where Na where A<:AbstractArray{T, N} where R<:Tuple where D<:Tuple where N where T}, PythonCall.Core.Py})
67+
68+
# Precompile lower-level conversion calls for common types and dimensions
69+
for T in (Int32, Int64, UInt32, UInt64, Float32, Float64)
70+
for N in (1, 2, 3, 4, 5)
71+
precompile(Tuple{typeof(PythonCall.Core.pyconvert), Type{Array{T, N}}, PythonCall.Core.Py})
72+
end
73+
end
74+
6475
end

0 commit comments

Comments
 (0)