Skip to content

Commit

Permalink
Use SnoopPrecompile for precompilation (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 authored Dec 30, 2022
1 parent e014cee commit 0f38124
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ImageDistances = "51556ac3-7006-55f5-8cb3-34580c88182d"
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5"
LazyModules = "8cdb02fc-e678-4876-92c5-9defec4f444e"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
Expand All @@ -19,6 +20,7 @@ ImageDistances = "0.2.4"
ImageFiltering = "0.6.3, 0.7"
LazyModules = "0.3"
OffsetArrays = "0.11, 1"
SnoopPrecompile = "1"
julia = "1"

[extras]
Expand Down
2 changes: 2 additions & 0 deletions src/ImageQualityIndexes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ include("msssim.jl")
include("colorfulness.jl")
include("entropy.jl")

include("precompile.jl")

export
# generic
assess,
Expand Down
18 changes: 18 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using SnoopPrecompile

@precompile_setup begin
imgs_list = Any[
[rand(Gray{N0f8}, 32, 32) for _ in 1:2],
[rand(RGB{N0f8}, 32, 32) for _ in 1:2],
[rand(Gray{Float64}, 32, 32) for _ in 1:2],
[rand(RGB{Float64}, 32, 32) for _ in 1:2],
[rand(N0f8, 32, 32) for _ in 1:2],
[rand(Float64, 32, 32) for _ in 1:2],
]
@precompile_all_calls begin
for imgs in imgs_list
assess_psnr(imgs...)
assess_ssim(imgs...)
end
end
end

0 comments on commit 0f38124

Please sign in to comment.