Skip to content

Optimize getImageData() #549

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

Merged
merged 2 commits into from
Apr 26, 2015
Merged

Conversation

aparshin
Copy link
Contributor

I've added an optimization of getImageCanvas() method for fully transparent and fully opaque pixels (typical situation). It speedups getImageData(0,0,100,100) test of benchmarks/run.js 2 - 8 times (different Ubuntu OSs). Moreover, 0/0 division (and the following NaN casting to int) for not filled pixels doesn't happen any more.

Mostly for fully transparent pixels
@kangax
Copy link
Collaborator

kangax commented Apr 26, 2015

LGTM, thanks! Could you just add a comment in code why the need for 2 branches.

@aparshin
Copy link
Contributor Author

Done!

kangax added a commit that referenced this pull request Apr 26, 2015
@kangax kangax merged commit 70162e6 into Automattic:master Apr 26, 2015
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.

2 participants