问题
I was wondering what is the difference between using a for loop, and using the dispatch_apply
function of GCD and couldn't find an answer in the documentation nor in questions here.
Also, will using the GCD function in a runtime situation as a GLKit render/update method will produce better results?
回答1:
Also, will using the GCD function in a runtime situation as a GLKit render/update method will produce better results?
The only way to answer that question is to try it and measure the performance.
回答2:
The documentation states :
The dispatch_apply() function provides data-level concurrency through a "for (;;)" loop like primitive:
This means that the code block called by dispatch_apply will not be called sequentially like the for but can execute concurrently.
来源:https://stackoverflow.com/questions/10330275/gcd-and-for-loops