JuliaIO / JpegTurbo.jl

Julia interface to libjpeg-turbo
MIT License
15 stars 7 forks source link

Avoid extra buffer indirection during decoding #30

Closed jkrumbiegel closed 11 months ago

jkrumbiegel commented 11 months ago

I noticed that the profiler recorded a lot of time in the copyto! code, so I tried refactoring that. To me it seems to be equivalent behavior, let's see what CI says. The memory gain is actually not much, but the time gained is about half.

# before
@time JpegTurbo.jpeg_decode("some_25MP.jpg")
0.860027 seconds (32 allocations: 169.126 MiB, 0.46% gc time)

# after
0.419224 seconds (30 allocations: 169.108 MiB, 1.75% gc time)
codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.19% :warning:

Comparison is base (d3e4d8e) 81.68% compared to head (b1bd80f) 81.50%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #30 +/- ## ========================================== - Coverage 81.68% 81.50% -0.19% ========================================== Files 6 6 Lines 202 200 -2 ========================================== - Hits 165 163 -2 Misses 37 37 ``` | [Files Changed](https://app.codecov.io/gh/JuliaIO/JpegTurbo.jl/pull/30?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaIO) | Coverage Δ | | |---|---|---| | [src/decode.jl](https://app.codecov.io/gh/JuliaIO/JpegTurbo.jl/pull/30?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaIO#diff-c3JjL2RlY29kZS5qbA==) | `87.85% <100.00%> (-0.23%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

johnnychen94 commented 11 months ago

Thanks for fixing this! I knew there's room for improvement here but I failed to figure out how.