Skip to content

Basic image blur algorithm runs 20-100x slower in Dartium than JS #5661

Closed
@blois

Description

@blois

Attached is a simple image blur application using a fairly object-oriented (yet usually efficient) scanline blur implementation.

The code is implemented in both Dart and Javascript, with absolute minimal delta.

On my machine, Dartium takes ~5000ms to process the image, dart2js is ~150ms and vanilla JS is 50ms.

Note that changing the pixel data types from Uint8ClampedArray (native type for Canvas data) to List<int> and an intermediate data list from Float32Array to List<int> moves this from 5000ms to 1600ms. The Uint8ClampedArray conversion is problematic as it incurs a heavy duplication of the image data which is not accounted for in the 1600ms. These arrays should really remain in their native data type as much as possible.

I'm sure there are many optimizations that could be done to this code, but it doesn't feel so terribly inefficient to warrant these performance differences.


Attachment:
blur.zip (223.55 KB)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions