Skip to content

perf(export): accelerate lossless JXL encoding#1368

Closed
VailElla wants to merge 7 commits into
CyberTimon:mainfrom
VailElla:codex/jxl-export-performance
Closed

perf(export): accelerate lossless JXL encoding#1368
VailElla wants to merge 7 commits into
CyberTimon:mainfrom
VailElla:codex/jxl-export-performance

Conversation

@VailElla

Copy link
Copy Markdown
Contributor

Description

Improve DNG-to-JPEG XL export throughput while preserving lossless output and the existing export validation/metadata/cancellation behavior. Lossless JXL now honors the selected Fast/Balanced/Best effort instead of always using the slowest effort, uses the shared Rayon pool for codec work, parallelizes 16-bit quantization, and avoids redundant 8/16-bit conversions.

This branch is intentionally cumulative: it contains the prerequisite RAW/JXL export stack plus this performance change, so it should be reviewed as the next stacked export update.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

  • Map the lossless JXL encoding-speed selector to efforts 4 (Fast), 5 (Balanced), and 7 (Best compression).
  • Enable shared-pool multithreading with with_threads(0) and parallelize high-precision sample quantization.
  • Reuse native 8-bit/16-bit image buffers when already in the requested format.
  • Keep the export controls and validation/round-trip coverage from the prerequisite JXL stack.

Screenshots/Videos

Manual export was exercised in the local macOS app. The generated JXL files remain local in /tmp/rapidraw-jxl-manual-20260713 and are not uploaded here.

Testing

  • I have tested these changes locally and confirmed that they work as expected without issues

Test Configuration:

  • OS: macOS 26.5.2
  • Hardware: Apple Silicon Mac16,7, 14 CPU cores
  • Manual DNG: IMG_2094.DNG, JPEG XL quality 100, 8-bit, metadata included, GPS removal enabled

Observed wall-clock time from pressing Save until the app returned to the export-ready state:

Mode Time Output
Fast ~7.8 s 6,272,665 bytes
Balanced ~8.0 s 6,228,328 bytes
Best compression ~43.0 s 3,728,944 bytes

All three outputs were recognized by macOS as JPEG XL containers.

Automated checks:

  • cargo +1.96.1 fmt --manifest-path src-tauri/Cargo.toml --check — passed
  • cargo +1.96.1 check --manifest-path src-tauri/Cargo.toml — passed (17 pre-existing warnings)
  • cargo +1.96.1 test --manifest-path src-tauri/Cargo.toml -- --nocapture — passed (37 tests)
  • npm run build — passed
  • ./node_modules/.bin/tauri build --debug --bundles app --no-sign — passed
  • git diff --check — passed

Known repository baseline checks (unchanged by this branch):

  • npm run typecheck currently reports 117 existing TypeScript errors across the repository.
  • npm run i18n:check currently reports existing plural-key drift in 11 locale files.

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors (baseline warnings/errors are documented above)

Additional Notes

  • The local debug app bundle was built unsigned for manual verification.
  • The branch includes the prerequisite export work associated with PR #1365 and PR #1366; the cumulative diff against main is expected.

AI Disclaimer:

  • This PR is entirely AI-generated
  • This PR is AI-generated but guided by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

@VailElla VailElla closed this Jul 13, 2026
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