parallel processing - Anonymous Functions Dont Work inside parfor loops in matlab? -


i'm not sure if found matlab bug or doing wrong, seems calling anonymous functions inside parfor loop slow down (even slower serial performance)

is correct?

see code:

tic; parfor i=1:6, min(randn(10000000,1)); end; toc tic; i=1:6, min(randn(10000000,1)); end; toc 

parallel elapsed time 0.510345 seconds.

serial elapsed time 0.932137 seconds.

same thing except using anon function:

q = @(x) min(randn(10000000,1)); tic; parfor i=1:6, q([]); end; toc   %parelel tic; i=1:6, q([]); end; toc     %serial   

parallel elapsed time 4.208346 seconds.

serial elapsed time 0.933594 seconds.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -