Lazily load ImageCore and ImageInTerminal using my newly written tool LazyModules.jl
This cuts the package loading latency from
julia> @time_imports using ReferenceTests
0.6 ms ┌ Compat
0.4 ms ┌ NaNMath
0.3 ms ┌ Adapt
33.8 ms ┌ OffsetArrays
35.5 ms ┌ PaddedViews
20.6 ms ┌ FixedPointNumbers
42.5 ms ┌ ChainRulesCore
43.4 ms ┌ ChangesOfVariables
5.3 ms ┌ AbstractFFTs
0.3 ms ┌ OpenLibm_jll
1.4 ms ┌ StackViews
2.0 ms ┌ MappedArrays
4.3 ms ┌ MosaicViews
0.5 ms ┌ InverseFunctions
0.1 ms ┌ Reexport
4.3 ms ┌ DocStringExtensions 68.85% compilation time
98.8 ms ┌ ColorTypes 4.71% compilation time
84.2 ms ┌ Colors
185.2 ms ┌ Graphics 2.51% compilation time
3.1 ms ┌ IrrationalConstants
0.4 ms ┌ TensorCore
0.7 ms ┌ LogExpFunctions
14.4 ms ┌ Preferences
15.0 ms ┌ JLLWrappers
143.5 ms ┌ OpenSpecFun_jll 89.07% compilation time (98% recompilation)
174.3 ms ┌ SpecialFunctions 73.33% compilation time (98% recompilation)
87.4 ms ┌ ColorVectorSpace 5.54% compilation time
811.2 ms ┌ ImageCore 18.82% compilation time (82% recompilation)
0.4 ms ┌ Requires
0.3 ms ┌ StatsAPI
4.4 ms ┌ Distances
24.5 ms ┌ Crayons
30.8 ms ┌ ImageBase
90.2 ms ┌ ImageInTerminal 11.81% compilation time (16% recompilation)
2.7 ms ┌ DeepDiffs
72.4 ms ┌ FileIO 8.02% compilation time
1042.8 ms ReferenceTests 16.22% compilation time (75% recompilation)
to
julia> @time_imports using ReferenceTests
0.8 ms ┌ LazyModules
0.4 ms ┌ Requires
0.5 ms ┌ StatsAPI
3.4 ms ┌ Distances
22.6 ms ┌ FixedPointNumbers
0.2 ms ┌ Reexport
1.3 ms ┌ DeepDiffs
68.3 ms ┌ FileIO 10.21% compilation time (21% recompilation)
94.6 ms ┌ ColorTypes 4.88% compilation time
60.3 ms ┌ Colors
332.7 ms ReferenceTests 6.82% compilation time (7% recompilation)
The caveats is world-age issues due to the dynamic lazy loading, thus a world-age issue test is added. Hopefully, it catches the issue in the long run.
The test time time julia-latest --startup=no --project=. -e 'using Pkg; Pkg.test()' is still ~35s
Lazily load ImageCore and ImageInTerminal using my newly written tool LazyModules.jl
This cuts the package loading latency from
to
The caveats is world-age issues due to the dynamic lazy loading, thus a world-age issue test is added. Hopefully, it catches the issue in the long run.
The test time
time julia-latest --startup=no --project=. -e 'using Pkg; Pkg.test()'
is still ~35s