iPhone/iPad:多次调用 NSLog() 是否会影响应用程序性能或内存?
我想知道多次 NSLog() 调用是否会影响应用程序性能或内存。 有谁知道这样的事情吗?
我想在我的应用程序中的每个函数中放置一个 NSLog() 调用(很多),以便我可以看到 崩溃后记录并跟踪问题。
谢谢。
I would like to know if having many NSLog() calls affects app performance or memory.
Does anyone know about such thing?
I want to put an NSLog() call in every function in my app (which is a lot) so that I can see
crash logs after and trace problems.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的。所以我在我的 pch 文件中定义了它。
我没有使用 NSLog,而是使用 DLog 和 ALog。
(注意或版权:我很久以前从其他一些我不记得的SO帖子中得到了这个代码。从我的代码片段库中再次粘贴它)
Yes. So I define this in my pch file.
Instead of using NSLog, I use DLog and ALog.
(Note or copyrights: I got this code long long ago from some other SO post which I don't remember. Pasting it again from my snippet library)
“取消定义”NSLog 的另一个简单解决方案:
在 .pch 文件中
Another easy solution to 'undefine' NSLog
In .pch file:
是的,它会降低性能,特别是如果该函数应该花费很短的时间,
NSLog
(这是一个 I/O 过程)将使它花费比预期更多的时间。Yes, it slows down the performance, especially if the function is supposed to take very short time, the
NSLog
(which is an I/O process) will make it take more time than expected.