Skip to content

Question about performance and FFI support #774

@WutangNailao

Description

@WutangNailao

Hi 👋,

Thanks for maintaining this great library — it’s very useful to have a pure-Dart image processing solution that works across Dart VM, Flutter and Web.

I have a question regarding implementation choices and performance:

Currently the library is implemented entirely in Dart (including codecs and pixel manipulation). That makes it extremely portable, but for many performance-sensitive use cases (e.g., large images, decoding/encoding, resizing) pure Dart ends up being significantly slower compared to native libraries — even when running in isolates.

Given that the Dart ecosystem now has support for dart:ffi and tools like ffigen, allowing bindings to native libraries (e.g., libjpeg-turbo, libpng, libwebp, or even optimized C/C++ image algorithms), I’m curious about the rationale for not offering an optional FFI-backed implementation or plugin variant to accelerate the heavy parts of this library.

  1. Has using FFI been considered?
    – Such as optionally calling into native image codecs or optimized routines for pixel operations.

  2. Are there technical limitations or project scope decisions that make FFI integration undesirable?

  3. Is it a deliberate design philosophy to keep everything in pure Dart for maximum portability and simplicity?
    – If so, is there any plan or openness to a separate FFI-accelerated extension package in the future?

Many other packages (e.g., imagekit_ffi) already explore FFI for faster encode/decode, showing this approach is feasible.

I’d love to understand the motivations and whether there’s room for performance enhancements while keeping the current API usable.

Thanks!

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