Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blois opened this issue Oct 5, 2012 · 9 comments
Closed

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

blois opened this issue Oct 5, 2012 · 9 comments
Milestone

Comments

@blois
Copy link

blois commented Oct 5, 2012

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)

@ghost
Copy link

ghost commented Oct 5, 2012

Set owner to @sgmitrovic.
Added this to the M2 milestone.
Added Triaged label.

@blois
Copy link
Author

blois commented Oct 5, 2012

Adding repro which runs from the local filesystem.


Attachment:
blur_local.zip (6.98 KB)

@iposva-google
Copy link
Contributor

I expect every single access to the Uint8ClampedArray (pixel data) and the Float32Array (pixel data window) to go through a native call since Dartium is not using any of the scalar list support.

There are two things to be done here:

  • Take the algorithm in this example and disassociate it from all dart:html code to make it a standalone benchmark using dart:scalarlist as well as just regular Lists.
  • Use the dart:scalarlist library in Dartium by fixing issue Acessing imageData is way too slow in the dart vm #3312.

We will continue the VM investigation of standalone performance here.

@ghost
Copy link

ghost commented Dec 5, 2012

Adding clamped Uint8ClampedList to VM. Will follow by optimizing access to it.

@iposva-google
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the M3 milestone.

@ghost
Copy link

ghost commented Dec 12, 2012

Issue #7347 has been merged into this issue.

@ghost
Copy link

ghost commented Jan 5, 2013

Optimized access with r16666. Waiting on Dartium to switch to VM's clamped array


Set owner to [email protected].
Removed Area-VM label.
Added Area-Dartium label.

@anders-sandholm
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@DartBot
Copy link

DartBot commented Mar 27, 2013

This comment was originally written by [email protected]


Should have been fixed now. Please, reopen if not the case.


Added Fixed label.

This issue was closed.
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

No branches or pull requests

4 participants