如果我使用Objective-C的低级代码,我的iPhone应用程序的性能命中率? [英] Will my iPhone app take a performance hit if I use Objective-C for low level code?

查看:163
本文介绍了如果我使用Objective-C的低级代码,我的iPhone应用程序的性能命中率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iPhone或其他便携式硬件上编程CPU密集型或GPU密集型应用程序时,您必须进行明智的算法决定,以便快速完成代码。

When programming a CPU intensive or GPU intensive application on the iPhone or other portable hardware, you have to make wise algorithmic decisions to make your code fast.

如果你使用的语言的执行效果比另一个更差,那么很好的算法选择可能会很慢。

But even great algorithm choices can be slow if the language you're using performs more poorly than another.

有比较Objective-C和C ++的硬数据,但也许只是在Mac桌面上,用于执行各种类似的语言方面?我非常熟悉本文比较C和Objective-C ,但这是一个更大的问题,比较两种面向对象语言彼此。

Is there any hard data comparing Objective-C to C++, specifically on the iPhone but maybe just on the Mac desktop, for performance of various similar language aspects? I am very familiar with this article comparing C and Objective-C, but this is a larger question of comparing two object oriented languages to each other.

例如,是一个C ++ vtable查找真的比Obj-信息?多快?线程,多态,排序等。在我开始构建一个包含重复的对象模型和各种测试代码的项目之前,我想知道是否有人已经做了这个,以及结果在哪里。这种类型的测试和比较是一个项目本身,可能需要相当长的时间。也许这不是一个项目,但只有两个,只有输出可以比较。

For example, is a C++ vtable lookup really faster than an Obj-C message? How much faster? Threading, polymorphism, sorting, etc. Before I go on a quest to build a project with duplicate object models and various test code, I want to know if anybody has already done this and what the results where. This type of testing and comparison is a project in and of itself and can take a considerable amount of time. Maybe this isn't one project, but two and only the outputs can be compared.

我在寻找硬数据,而不是传福音。像许多人一样,我出于各种原因喜欢和讨厌这两种语言。此外,如果有人在那里积极地追求同样的事情,我会在一些代码中看到最终结果有趣,我相信其他人也会帮助。我的猜测是,他们都有优势和弱点,我的目标是准确地找出他们是什么,以便他们可以在现实世界的场景中避免/利用。

I'm looking for hard data, not evangelism. Like many of you I love and hate both languages for various reasons. Furthermore, if there is someone out there actively pursuing this same thing I'd be interesting in pitching in some code to see the end results, and I'm sure others would help out too. My guess is that they both have strengths and weaknesses, my goal is to find out precisely what they are so that they can be avoided/exploited in real-world scenarios.

推荐答案

Mike Ash在他的帖子中有一些硬数字用于执行各种Objective-C方法调用与C和C ++ 常见操作的性能比较。此外,Savoy Software的此帖
是一个有趣的读者,当谈到调整一个iPhone的性能应用程序通过使用Objective-C ++。

Mike Ash has some hard numbers for performance of various Objective-C method calls versus C and C++ in his post "Performance Comparisons of Common Operations". Also, this post by Savoy Software is an interesting read when it comes to tuning the performance of an iPhone application by using Objective-C++.

我倾向于更喜欢Objective-C的干净,描述性的语法,而不是Objective-C + +,并没有发现语言本身是源我的性能瓶颈。我甚至倾向于做一些事情,我知道牺牲一点点的性能,如果他们使我的代码更可维护。

I tend to prefer the clean, descriptive syntax of Objective-C over Objective-C++, and have not found the language itself to be the source of my performance bottlenecks. I even tend to do things that I know sacrifice a little bit of performance if they make my code much more maintainable.

这篇关于如果我使用Objective-C的低级代码,我的iPhone应用程序的性能命中率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆