如何提高JSON的性能

时间:2014-02-18 06:14:36

标签: php json

我有一个JSON对象,我使用PHP以下列格式生成

[{
    "timestamp": "12\/16\/2013 0:00",
    "curr_property": "7211",
    "curr_property_cost": "123",
    "day_property": "48",
    "day_property_cost": "281",
    "curr_solar_generating": "4958",
    "curr_solar_export": "0",
    "day_solar_generated": "33",
    "day_solar_export": "0",
    "curr_chan1": "1964",
    "curr_chan2": "4958",
    "curr_chan3": "289",
    "day_chan1": "13",
    "day_chan2": "33",
    "day_chan3": "1"
},
{
    "timestamp": "12\/16\/2013 0:00",
    "curr_property": "7211",
    "curr_property_cost": "123",
    "day_property": "48",
    "day_property_cost": "281",
    "curr_solar_generating": "4958",
    "curr_solar_export": "0",
    "day_solar_generated": "33",
    "day_solar_export": "0",
    "curr_chan1": "1964",
    "curr_chan2": "4958",
    "curr_chan3": "289",
    "day_chan1": "13",
    "day_chan2": "33",
    "day_chan3": "1"
}]

将格式更改为

    [{
    "timestamp": ["12\/16\/2013 0:00", "12\/16\/2013 0:00", ..........],
    "curr_property": ["7211","32432",...........],
    "day_chan3": ["1","2","3"............]
}

提高性能?我是JSON的新手,所以请建议我提高应用程序速度的方法,因为JSON数据的数量非常大,接近40 MB并且还在增长。

1 个答案:

答案 0 :(得分:0)

您正试图了解如何加快申请速度?然后使用XDebug。 http://xdebug.com/ XDebug会告诉你代码的哪些部分很慢。不要只是随意猜测什么是慢的。