【问题标题】:Appcelerator / Titanium - Will outputting this entire JSON response harm the app performance?Appcelerator / Titanium - 输出整个 JSON 响应会损害应用程序性能吗?
【发布时间】:2014-01-31 13:05:34
【问题描述】:

我正在发出 HTTP 请求并为我的应用数据提取 JSON 结构。我使用了 Alloy 文档中的代码,其中包含一行输出整个响应文本以进行调试的行。这会影响应用在运行时的整体性能吗?

var xhr = Ti.Network.createHTTPClient({
    onload: function(e) {
        Ti.API.debug(this.responseText);         
        // rest of function...
    }
});

【问题讨论】:

    标签: javascript titanium httprequest appcelerator titanium-alloy


    【解决方案1】:

    Ti.API.debug() 不会在开发环境之外执行,它对性能的影响是无关紧要的。

    但是,如果你想确保你可以通过简单的操作编写执行 >1000 的函数:添加、乘以随机值并比较执行时间。

    【讨论】:

      猜你喜欢
      • 2011-10-13
      • 2011-01-11
      • 2010-11-08
      • 2018-05-29
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多