From 6ca45f8d2d659fbb99c30fdb89902d3c7b0e0ee7 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 7 Jan 2026 15:41:45 -0500 Subject: [PATCH] Add NamedArrayPartition and Float32 ArrayPartition to precompilation workload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/precompilation.jl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/precompilation.jl b/src/precompilation.jl index baf32249..c4bd1ec9 100644 --- a/src/precompilation.jl +++ b/src/precompilation.jl @@ -68,5 +68,31 @@ using PrecompileTools _ = size(va) _ = ndims(va) _ = size(ap) + + # NamedArrayPartition with Float64 vectors + nap = NamedArrayPartition(a = [1.0, 2.0], b = [3.0, 4.0, 5.0]) + + # NamedArrayPartition operations + _ = nap.a + _ = nap.b + _ = nap[1] + _ = length(nap) + + # NamedArrayPartition broadcasting + nap2 = nap .+ 1.0 + nap3 = nap .* 2.0 + + # similar for NamedArrayPartition + _ = similar(nap) + + # Float32 support for ArrayPartition (commonly used in scientific computing) + ap32 = ArrayPartition(Float32[1.0, 2.0], Float32[3.0, 4.0, 5.0]) + _ = ap32[1] + ap32_2 = ap32 .+ Float32(1.0) + ap32_3 = ap32 .* Float32(2.0) + ap32_4 = ap32 .+ ap32 + _ = similar(ap32) + _ = recursive_mean(ap32) + _ = recursivecopy(ap32) end end