GCD and for loops

戏子无情 提交于 2019-12-13 02:39:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!