Skip to content
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

Performance hit from try/catch #3

Open
mbloch opened this issue Jan 18, 2014 · 1 comment
Open

Performance hit from try/catch #3

mbloch opened this issue Jan 18, 2014 · 1 comment

Comments

@mbloch
Copy link

mbloch commented Jan 18, 2014

It looks like the presence of try/catch statements in your blur functions is affecting performance. After removing the try/catch, I saw a 2.5x speedup blurring a 1000x1000 image using stack blur in Chrome (version 32). Other browsers had smaller improvements.

Apparently functions containing try/catch statements will run in unoptimized mode in Chrome and other browsers, which even affects the performance of code outside the try block. (e.g. http://jsperf.com/213123123901230291)

Putting the blur calculations into separate functions should fix this.

@Quasimondo
Copy link
Owner

Ah, that's very interesting -. thanks for reporting it! I can surely remove the try/catch and have everyone handle those errors themselves.

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

2 participants