Skip to content

deps: migrate to LibDeflate v1, require Julia 1.12 - #63

Open
Beforerr wants to merge 1 commit into
mainfrom
push-nzmpykxklxqn
Open

deps: migrate to LibDeflate v1, require Julia 1.12#63
Beforerr wants to merge 1 commit into
mainfrom
push-nzmpykxklxqn

Conversation

@Beforerr

@Beforerr Beforerr commented Aug 30, 2026

Copy link
Copy Markdown
Member

LibDeflate v1 requires Julia >= 1.12, so raise the julia compat bound and
drop the lts CI entry.

v1's unsafe_gzip_decompress! subsumes the hand-rolled _unsafe_gzip_decompress!
in src/decompress/gzip.jl, which is deleted. Beyond the API change this gains:

  • a length check on short input, where the old code computed
    UInt(cSize - 10) and threw InexactError out of a GC.@preserve block
  • ISIZE validation, which the old code read but trusted
  • trailer located via libdeflate's consumed-input count instead of the
    last 8 bytes of the range (equivalent here, since CDF supplies an exact
    cSize, but no longer an assumption we own)

The known-size path is kept via the 5-arg form, which also tightens the
CVVR payload to exactly N * sizeof(eltype(dest)); the old code accepted a
short ISIZE and left the tail of dest uninitialized.

The whole-file (CCR) path now uses gzip_isize_decompress!, dropping the
length(input) * 10 output-size guess that could fail on high compression
ratios when the expected size was unknown.

LibDeflate v1 requires Julia >= 1.12, so raise the julia compat bound and
drop the `lts` CI entry.

v1's unsafe_gzip_decompress! subsumes the hand-rolled _unsafe_gzip_decompress!
in src/decompress/gzip.jl, which is deleted. Beyond the API change this gains:

  - a length check on short input, where the old code computed
    UInt(cSize - 10) and threw InexactError out of a GC.@preserve block
  - ISIZE validation, which the old code read but trusted
  - trailer located via libdeflate's consumed-input count instead of the
    last 8 bytes of the range (equivalent here, since CDF supplies an exact
    cSize, but no longer an assumption we own)

The known-size path is kept via the 5-arg form, which also tightens the
CVVR payload to exactly N * sizeof(eltype(dest)); the old code accepted a
short ISIZE and left the tail of dest uninitialized.

The whole-file (CCR) path now uses gzip_isize_decompress!, dropping the
length(input) * 10 output-size guess that could fail on high compression
ratios when the expected size was unknown.

Base.OncePerProcess is unconditional on 1.12, so the decompressor-pool
fallback in src/loading/variable.jl goes away.

Claude-Session: https://claude.ai/code/session_01TFkXrFHTxMKhiaoTHVQZ9F
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
main 28ad4a8... main / 28ad4a8...
elx/full_load 0.0372 ± 0.0022 ms 0.0368 ± 0.0025 ms 1.01 ± 0.091
elx/sum_array 2.87 ± 0.56 μs 2.71 ± 0.52 μs 1.06 ± 0.29
elx/sum_lazy 2.21 ± 1.2 μs 2.56 ± 1.3 μs 0.867 ± 0.65
elx/sum_var_access 3.13 ± 0.78 μs 3.25 ± 0.77 μs 0.963 ± 0.33
elx/var_access 0.281 ± 0.031 μs 0.291 ± 0.031 μs 0.966 ± 0.15
mms/full_load 21.9 ± 2.3 μs 21.6 ± 2.2 μs 1.01 ± 0.15
mms/sum_array 0.0953 ± 0.013 s 0.0949 ± 0.012 s 1.01 ± 0.19
mms/sum_slice 3.57 ± 0.088 ms 3.57 ± 0.1 ms 0.999 ± 0.038
mms/sum_var_access 3.56 ± 0.088 ms 3.57 ± 0.082 ms 0.996 ± 0.034
mms/var_access 0.12 ± 0.01 μs 0.11 ± 0.01 μs 1.09 ± 0.13
time_to_load 0.145 ± 0.00092 s 0.14 ± 0.00033 s 1.04 ± 0.007
Memory benchmarks
main 28ad4a8... main / 28ad4a8...
elx/full_load 0.217 k allocs: 24.8 kB 0.217 k allocs: 24.8 kB 1
elx/sum_array 5 allocs: 27.7 kB 5 allocs: 27.7 kB 1
elx/sum_lazy 5 allocs: 27.7 kB 5 allocs: 27.7 kB 1
elx/sum_var_access 7 allocs: 28 kB 7 allocs: 28 kB 1
elx/var_access 1 allocs: 0.234 kB 1 allocs: 0.234 kB 1
mms/full_load 0.065 k allocs: 6.45 kB 0.065 k allocs: 6.45 kB 1
mms/sum_array 1.03 k allocs: 31.7 MB 0.524 k allocs: 31.6 MB 1
mms/sum_slice 0.064 k allocs: 1.29 MB 0.045 k allocs: 1.29 MB 1
mms/sum_var_access 0.064 k allocs: 1.29 MB 0.045 k allocs: 1.29 MB 1
mms/var_access 1 allocs: 0.219 kB 1 allocs: 0.219 kB 1
time_to_load 0.149 k allocs: 11.2 kB 0.149 k allocs: 11.2 kB 1

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant