GCD and for loops

2019-08-08 00:29发布

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?

2条回答
女痞
2楼-- · 2019-08-08 00:52

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.

查看更多
Animai°情兽
3楼-- · 2019-08-08 01:14

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.

查看更多
登录 后发表回答