私人成员是否会增加任何性能优势?
我知道(至少对于一些 JIT 语言,如 Java),将成员变量声明为私有允许进行某些编译器优化。我意识到这可能并不普遍正确,但我在实践中看到了这一点,特别是在涉及 Java 的嵌入式 JIT 编译器时。我的问题是,私有成员可以在 Objective-C LLVM 中赋予任何编译时好处(或运行时好处)吗?
我要求的是我自己的启发,所以请不要发表“不要过早优化”的评论。
I know that (at least for some JIT-ed languages like Java) that declaring member variables private allow certain compiler optimizations to take place. I realize that this may not be universally true, but I've seen this in practice particularly when it comes to embedded JIT compilers for Java. My question is, is there any compile-time benefit (or run time benefit) that private members can confer in Objective-C LLVM?
I'm asking for my own edification, so please no "don't prematurely optimize" comments.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@private ivars 中的“私人会员”?如果是这样,那么不,编译器不能做任何优化这些事情,它纯粹是指定 ivar 契约的标记。
"Private members" as in @private ivars? If so then no, the compiler can't do anything as far as optimizing those, its purely a marker to specify the contract of the ivar.