JuliaImages / ImageView.jl

Interactive display of images and movies
MIT License
135 stars 34 forks source link

Switch to SnoopPrecompile for precompilation #277

Closed timholy closed 1 year ago

timholy commented 1 year ago

On my machine, on master with Julia 1.6:

julia> @time using ImageCore, ImageView
  3.133214 seconds (7.36 M allocations: 474.322 MiB, 9.91% gc time, 43.39% compilation time)

julia> @time @eval img = rand(RGB{N0f8}, 100, 120);
  0.156444 seconds (825.12 k allocations: 49.383 MiB, 11.35% gc time, 99.81% compilation time)

julia> @time @eval h = imshow(img);
  2.514401 seconds (8.79 M allocations: 520.388 MiB, 4.35% gc time, 4.57% compilation time)

With Julia nightly, on the master branch of ImageView it's somewhat better:

julia> @time using ImageCore, ImageView
  2.439186 seconds (6.09 M allocations: 382.197 MiB, 7.44% gc time, 14.67% compilation time)

julia> @time @eval img = rand(RGB{N0f8}, 100, 120);
  0.121767 seconds (260.59 k allocations: 17.305 MiB, 12.40% gc time, 168.10% compilation time)

julia> @time @eval h = imshow(img);
  0.792889 seconds (1.16 M allocations: 74.301 MiB, 1.84% gc time, 102.55% compilation time: 2% of which was recompilation)

But it's best with this PR:

julia> @time using ImageCore, ImageView
  2.585504 seconds (6.80 M allocations: 422.312 MiB, 9.54% gc time, 13.56% compilation time)

julia> @time @eval img = rand(RGB{N0f8}, 100, 120);
  0.000396 seconds (96 allocations: 40.219 KiB)

julia> @time @eval h = imshow(img);
  0.216154 seconds (5.63 k allocations: 362.281 KiB, 31.35% compilation time)

Almost 4x faster to show the first window.

codecov[bot] commented 1 year ago

Codecov Report

Base: 84.04% // Head: 84.61% // Increases project coverage by +0.56% :tada:

Coverage data is based on head (2a2d41c) compared to base (328f485). Patch has no changes to coverable lines.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #277 +/- ## ========================================== + Coverage 84.04% 84.61% +0.56% ========================================== Files 6 6 Lines 840 832 -8 ========================================== - Hits 706 704 -2 + Misses 134 128 -6 ``` | [Impacted Files](https://codecov.io/gh/JuliaImages/ImageView.jl/pull/277?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages) | Coverage Δ | | |---|---|---| | [src/ImageView.jl](https://codecov.io/gh/JuliaImages/ImageView.jl/pull/277?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages#diff-c3JjL0ltYWdlVmlldy5qbA==) | `89.65% <ø> (+1.34%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

timholy commented 1 year ago

The segfault is worrisome, but does not seem related to this PR (see https://github.com/JuliaGizmos/GtkObservables.jl/pull/43).