好吧,我正在尝试在使用 httpservice 的项目中使用远程对象(Amfphp)。我听说它会让我的申请更快。但是当我在数据网格中尝试 Amfphp 以进行测试时,我发现它比 httpservice 需要更多时间。这是我到目前为止所做的。
调用 php 函数的 AS-3 代码:
public function init():void{
var params:Array = new Array();
params.push("1234");
_amf = new RemoteObject;
_amf.destination = "dummyDestination";
_amf.endpoint = "http://insight2.ultralysis.com/Amfphp/Amfphp/";//http://insight2.ultralysis.com
_amf.source = "manager1";
_amf.addEventListener(ResultEvent.RESULT, handleResult);
_amf.addEventListener(FaultEvent.FAULT, handleFault);
_amf.init(params);
}
public function handleResult(event:ResultEvent):void{
myGrid.dataProvider = event.result.grid;
}
以及从 mysql 数据库中获取数据的 php 函数:
class output{
public $grid;
public $week;
}
function form()
{
$arrayOut = new output();
$arrayOut->grid = $this->gridValue();
$arrayOut->week= $this->getAllWeek($this->ThisYear);
return $arrayOut;
}
一切正常。但是获取和渲染 280 行数据需要将近 5 秒的时间。任何人都可以帮我尽可能快地完成它吗?我已经尝试过silexlabs的优化技巧
我使用了数据包嗅探器,统计数据如下。它说延迟大部分时间消耗大约 5 秒。什么是延迟?需要帮助的家伙。请: