CoreFoundation vs Foundation

前端 未结 2 438
陌清茗
陌清茗 2021-01-30 17:32

In iPhone development, speed is of the essence. Does anyone know if there is a speed difference between using a CoreFoundation type (like CFMutableDictionaryRef) versus a Founda

2条回答
  •  一个人的身影
    2021-01-30 18:10

    Writing code in CF functions will indeed bring a performance boost to your app, however there's another better approach for improving the performance: writing directly in assembly would bring even more performance benefits (though this is an extreme approach).

    High-level language constructs are preferable to the low-level ones for at least the reasons Peter Hosey mentioned. To this we can add the premature optimization which can easily lead to the failure of the project, as the developer is more concerned with the non-functional aspects of the application instead of the functional ones.

    If, after you have a fully functional app, you feel that some parts of the code have performance bottlenecks, you can try to optimize those, by rewriting them to low-level language constructs. You'll at least have a comparison point with the current code, to make sure the low-level code behaves as expected (either manual or unit tests will do the trick here).

提交回复
热议问题