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

tuning for real time processing(150~250% better performance) #10

Open
wants to merge 5 commits into
base: unstable
Choose a base branch
from

Conversation

Kanasansoft
Copy link

I did tuning for real time processing.
(example : use with WebRTC)

about 150~250% better performance.

demo
http://www.kanasansoft.com/Kanasansoft/computer_vision_for_real_time_processing/computer_vision_for_real_time_processing.html

 * Math.floor(x) => (x | 0)
 * x * 2 => (x << 1);
 * x * 4 => (x << 2);
 * x * 8 => (x << 3);
 * etc.
 * reference property is slow.
@liuliu
Copy link
Owner

liuliu commented May 3, 2012

Thanks! I will take a look this weekend and merge it.

@Kanasansoft
Copy link
Author

p.s.
The parallable function use Web Workers.
First postMessage is error because of Web Workers can not send (msg contain) CanvasPixelArray.
JSON.stringify run before second postMessage.
JSON.stringify is slowly for big data.
And JSON.parse run in worker thread.
JSON.parse is slowly for big data, too.

in my mathine
JSON.stringify : over 2000ms
JSON.parse : about 1500ms

@liuliu
Copy link
Owner

liuliu commented May 4, 2012

Google Chrome does a terrible job in doing this. It can pass around JSON object, but it does JSON serialization internally. Firefox gets this right and passes JSON object directly. That is why parallable works OK in Firefox. Of course, I checked the Web Worker spec about 1 and half years ago, there is a great chance that I am outdated :)

@Kanasansoft
Copy link
Author

I see.

@liuliu
Copy link
Owner

liuliu commented Jul 2, 2012

Thanks, I will do a manual merge for ccv.js, but not ccv_in_realtime.js. I intended to make ccv.js truly work with web worker :-)

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