Skip to content

Migrate react-native-compressor to Nitro Modules for better performance and smaller binary size #381

@alireza-k74

Description

@alireza-k74

Title

Migrate react-native-compressor to Nitro Modules for better performance and smaller binary size


Description

Hi 👋
First of all, thank you for maintaining react-native-compressor. It’s a very useful library and widely used in production apps.

I’d like to propose migrating this library to Nitro Modules, similar to recent high-performance React Native libraries such as react-native-nitro-fs and react-native-fetch-nitro.


Motivation

1. Performance improvements

Nitro Modules significantly reduce JS ↔ Native overhead by relying directly on JSI instead of the classic NativeModule bridge.

This would be especially beneficial for CPU-intensive tasks such as:

  • Image compression
  • Video compression
  • Batch file compression

Lower overhead would result in faster execution and more stable performance, particularly on lower-end Android devices.


2. Smaller Android binary (AAB/APK) size

Nitro Modules allow:

  • More granular native code inclusion
  • Better dead-code elimination
  • Reduced reliance on large shared native libraries

This is becoming increasingly important due to stricter Google Play size and native dependency checks.


3. Better alignment with React Native New Architecture

  • Nitro Modules fit naturally with JSI, TurboModules, and Fabric
  • More future-proof than the legacy NativeModule approach
  • Easier to optimize and maintain long-term

4. Improved developer experience

  • Cleaner native bindings
  • More predictable performance characteristics
  • Easier reasoning about threading and memory usage during compression

Current pain points (user perspective)

  • Compression can feel slow on some devices
  • Native overhead is noticeable when compressing multiple files sequentially
  • App size increases when combined with other native-heavy libraries

Proposed approach

  • Introduce a Nitro-based implementation (possibly experimental at first)
  • Keep the existing implementation for backward compatibility
  • Gradually migrate core compression logic to Nitro Modules

Willingness to help

I’d be happy to:

  • Test an experimental Nitro implementation
  • Share benchmarks (before / after)
  • Provide feedback from real-world production usage

Thanks again for your work on this library 🙏
Looking forward to your thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions