Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading JPEG image with ImageMagick becomes very slow in Julia 1.7 #992

Closed
etibarg opened this issue Dec 1, 2021 · 4 comments
Closed

Loading JPEG image with ImageMagick becomes very slow in Julia 1.7 #992

etibarg opened this issue Dec 1, 2021 · 4 comments

Comments

@etibarg
Copy link

etibarg commented Dec 1, 2021

Hello,

I've noticed a huge slowdown during image loading this morning, after migrating to julia 1.7.0.

Before:

julia> @time rgb = load("00070__.jpg")
  5.381018 seconds (97 allocations: 1.268 GiB, 3.26% gc time)
10652×14204 Array{RGB{N0f8},2} with eltype RGB{N0f8}:

After:

julia> @time rgb = load("00070__.jpg")
 85.531723 seconds (1.82 G allocations: 62.142 GiB, 8.78% gc time, 0.00% compilation time)
10652×14204 Array{RGB{N0f8},2} with eltype RGB{N0f8}:

The image weights ~30Mo.
Clearly, there's something wrong with the allocation. But what/why?

julia> versioninfo()
Julia Version 1.7.0
Commit 3bf9d17731 (2021-11-30 12:12 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, tigerlake)

Thanks,

NB: It's the first time I'm posting an issue. Sorry if it's the wrong place. (Should it be in julia repo?)

@johnnychen94
Copy link
Member

johnnychen94 commented Dec 1, 2021

Looks like it's an ImageMagick issue and is specific to ImageMagick.

(@v1.7) pkg> activate --temp

(jl_LojMuo) pkg> add ImageMagick TestImages

julia> using TestImages, ImageMagick

julia> file = testimage("earth_apollo17"; download_only=true)
"/Users/jc/.julia/artifacts/e752bdc739f34d02e79c7fa834bc2f2e0d71c7e0/earth_apollo17.jpg"

julia> @time ImageMagick.load(file);
  4.090564 seconds (110.18 M allocations: 3.807 GiB, 9.25% gc time, 13.21% compilation time)

QuartzImageIO on macOS works "normally" here:

julia> using QuartzImageIO

julia> @time QuartzImageIO.load(file);
  0.468937 seconds (61 allocations: 68.716 MiB, 5.63% gc time)

So we need someone with the expertise to bring a Julia wrapper for JpegTurbo; I'm interested in this but I don't have much free time until Feb..

I'm moving this to Images so that more people notice this issue.

@johnnychen94 johnnychen94 transferred this issue from JuliaImages/juliaimages.github.io Dec 1, 2021
@johnnychen94 johnnychen94 changed the title Image loading slowdown after migration to julia 1.7.0 Loading JPEG image with ImageMagick becomes very slow in Julia 1.7 Dec 1, 2021
@originalsouth
Copy link

This would probably be a good starter https://github.com/stevengj/JpegTurbo.jl

@johnnychen94
Copy link
Member

The last step now: JuliaRegistries/General#53821

@johnnychen94
Copy link
Member

johnnychen94 commented Feb 7, 2022

Closing this as JpegTurbo.jl is now available in ImageIO v0.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants