Skip to content

Commit 6ca45f8

Browse files
committed
Add NamedArrayPartition and Float32 ArrayPartition to precompilation workload
This improves time-to-first-execution (TTFX) by adding commonly-used operations to the precompilation workload: 1. NamedArrayPartition - constructor, property access, indexing, broadcasting, similar 2. Float32 ArrayPartition - constructor, indexing, broadcasting, similar, recursive_mean, recursivecopy Performance improvements: - Float32 ArrayPartition broadcasting: ~0.4s → 0.00008s (~5000x faster) - Float32 ArrayPartition constructor: ~0.05s → 0.0003s (~180x faster) - NamedArrayPartition operations now sub-millisecond Package startup time remains unchanged at ~0.26s. Only 4 low-impact invalidations were found (all necessary for package functionality). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 28c9ef1 commit 6ca45f8

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

src/precompilation.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,31 @@ using PrecompileTools
6868
_ = size(va)
6969
_ = ndims(va)
7070
_ = size(ap)
71+
72+
# NamedArrayPartition with Float64 vectors
73+
nap = NamedArrayPartition(a = [1.0, 2.0], b = [3.0, 4.0, 5.0])
74+
75+
# NamedArrayPartition operations
76+
_ = nap.a
77+
_ = nap.b
78+
_ = nap[1]
79+
_ = length(nap)
80+
81+
# NamedArrayPartition broadcasting
82+
nap2 = nap .+ 1.0
83+
nap3 = nap .* 2.0
84+
85+
# similar for NamedArrayPartition
86+
_ = similar(nap)
87+
88+
# Float32 support for ArrayPartition (commonly used in scientific computing)
89+
ap32 = ArrayPartition(Float32[1.0, 2.0], Float32[3.0, 4.0, 5.0])
90+
_ = ap32[1]
91+
ap32_2 = ap32 .+ Float32(1.0)
92+
ap32_3 = ap32 .* Float32(2.0)
93+
ap32_4 = ap32 .+ ap32
94+
_ = similar(ap32)
95+
_ = recursive_mean(ap32)
96+
_ = recursivecopy(ap32)
7197
end
7298
end

0 commit comments

Comments
 (0)