1. <small id='3jZsZ'></small><noframes id='3jZsZ'>

    • <bdo id='3jZsZ'></bdo><ul id='3jZsZ'></ul>
  2. <legend id='3jZsZ'><style id='3jZsZ'><dir id='3jZsZ'><q id='3jZsZ'></q></dir></style></legend>
    <tfoot id='3jZsZ'></tfoot>
    1. <i id='3jZsZ'><tr id='3jZsZ'><dt id='3jZsZ'><q id='3jZsZ'><span id='3jZsZ'><b id='3jZsZ'><form id='3jZsZ'><ins id='3jZsZ'></ins><ul id='3jZsZ'></ul><sub id='3jZsZ'></sub></form><legend id='3jZsZ'></legend><bdo id='3jZsZ'><pre id='3jZsZ'><center id='3jZsZ'></center></pre></bdo></b><th id='3jZsZ'></th></span></q></dt></tr></i><div id='3jZsZ'><tfoot id='3jZsZ'></tfoot><dl id='3jZsZ'><fieldset id='3jZsZ'></fieldset></dl></div>

      NSNotificationCenter 与委托 - 哪个更快?

      时间:2023-07-28
            <tbody id='H2VPa'></tbody>
            <bdo id='H2VPa'></bdo><ul id='H2VPa'></ul>

          • <small id='H2VPa'></small><noframes id='H2VPa'>

            <i id='H2VPa'><tr id='H2VPa'><dt id='H2VPa'><q id='H2VPa'><span id='H2VPa'><b id='H2VPa'><form id='H2VPa'><ins id='H2VPa'></ins><ul id='H2VPa'></ul><sub id='H2VPa'></sub></form><legend id='H2VPa'></legend><bdo id='H2VPa'><pre id='H2VPa'><center id='H2VPa'></center></pre></bdo></b><th id='H2VPa'></th></span></q></dt></tr></i><div id='H2VPa'><tfoot id='H2VPa'></tfoot><dl id='H2VPa'><fieldset id='H2VPa'></fieldset></dl></div>

            <tfoot id='H2VPa'></tfoot><legend id='H2VPa'><style id='H2VPa'><dir id='H2VPa'><q id='H2VPa'></q></dir></style></legend>

              1. 本文介绍了NSNotificationCenter 与委托 - 哪个更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我已经阅读了很多关于每种方法的优缺点的信息,并且我知道代表通常是针对一个听众的,而通知是针对许多听众的.问题是关于性能的.

                I have read a lot about the pros and cons of each , and i know delegates are usually for one listener, and notifications are for many. The question is about performance.

                我已阅读:NSNotificationCenter 与委派(使用协议)?

                我正在通过通知从麦克风向另一个班级发送音频信号.我知道我应该在这里使用委托,但我的问题是:委托会更快吗?因为我可以看到我有一些帧速率问题(降低),我想知道原因是否可能是使用通知而不是委托,或者没有关系?

                I am sending audio signals from mic, to another class by notification . i know that here i should use the delegate BUT my question is : does delegates will be faster ? because i can see i have some frame rate issue(decreased), and i would like to know if the cause could be the using of notification instead of delegate, or there is no relation ?

                推荐答案

                委托的开销更少,因此执行速度更快.

                Delegates come with less overhead and will therefore be executed much faster.

                但是,一般来说,您应该只在可能成为问题的地方查看性能主题.对于像发送通知和调用委托这样的一次性任务,这永远不会成为问题.但是,当您计划在循环中使用变量(取决于数据)执行这些操作时,或者对于您已获取或接收数据的许多数据对象,无法预测会有多少 - 这些情况是我会考虑性能优化.

                However, in general you should look on performance topics only there where they are likely to be an issue at all. For once-off tasks like sending a notification vs calling a delegate this should never be an issue. But when you plan to perform these in a loop with a variable (depending on data) number of intarations or for a number of data objects where you have fetched or received the data an cannot predict how many there will be - those are the situations where I would consider performance optimization.

                这篇关于NSNotificationCenter 与委托 - 哪个更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:NSURLConnection 不调用委托方法 下一篇:FirebaseCloudMessaging:FirebaseInstanceId 后台同步失败 - SERVICE_N

                相关文章

                  <small id='Vdm3A'></small><noframes id='Vdm3A'>

                    <bdo id='Vdm3A'></bdo><ul id='Vdm3A'></ul>
                1. <tfoot id='Vdm3A'></tfoot>
                2. <i id='Vdm3A'><tr id='Vdm3A'><dt id='Vdm3A'><q id='Vdm3A'><span id='Vdm3A'><b id='Vdm3A'><form id='Vdm3A'><ins id='Vdm3A'></ins><ul id='Vdm3A'></ul><sub id='Vdm3A'></sub></form><legend id='Vdm3A'></legend><bdo id='Vdm3A'><pre id='Vdm3A'><center id='Vdm3A'></center></pre></bdo></b><th id='Vdm3A'></th></span></q></dt></tr></i><div id='Vdm3A'><tfoot id='Vdm3A'></tfoot><dl id='Vdm3A'><fieldset id='Vdm3A'></fieldset></dl></div>

                    <legend id='Vdm3A'><style id='Vdm3A'><dir id='Vdm3A'><q id='Vdm3A'></q></dir></style></legend>