Symfony 1.4 と AJAX で速度の問題があります。
私のルーティング:
ajax_search:
url: /search.:sf_format
param: { module: article, action: articlesAjaxSearch, sf_format: html }
requirements:
sf_format: (?:html|js)
私のjs:
jQuery.ajax({
type: 'GET',
url: jQuery('#searchform').attr('action'),
data: form_data,
success: function(result)
{
jQuery("#searchform #searchresult").html(result).slideDown('fast');
}
});
私の行動:
public function executeArticlesAjaxSearch(sfWebRequest $request) {
$this->getResponse()->setContent("<html><body>Hello, World!</body></html>");
return sfView::NONE;
}
これは短いバージョンですが、速度を改善する必要があります。AJAX 呼び出しは、この HTML コンテンツを取得するのに約 200 ミリ秒かかります。
これが私のログです:
Sep 05 09:25:58 symfony [info] {articleActions} Call "articleActions->executeArticlesAjaxSearch()"
Sep 05 09:25:58 symfony [info] {sfWebResponse} Send status "HTTP/1.1 200 OK"
Sep 05 09:25:58 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8"
Sep 05 09:25:58 symfony [info] {sfWebDebugLogger} Configuration 0.88 ms (8)
Sep 05 09:25:58 symfony [info] {sfWebDebugLogger} Factories 53.19 ms (1)
Sep 05 09:25:58 symfony [info] {sfWebDebugLogger} Action "article/articlesAjaxSearch" 115.39 ms (1)
Sep 05 09:25:58 symfony [info] {sfWebDebugLogger} Database (Doctrine) 0.01 ms (3)
Sep 05 09:25:58 symfony [info] {sfWebDebugLogger} View "None" for "article/articlesAjaxSearch" 0.00 ms (1)
Sep 05 09:25:58 symfony [info] {sfWebResponse} Send content (39 o)
symfony 1 の ajax リクエスト速度を向上させるソリューションが必要です
Sep 05 09:25:58 symfony [info] {sfWebDebugLogger} Action "article/articlesAjaxSearch" 115.39 ms (1)
なぜこんなに時間がかかるのか理解できません。解決策を1日以上探している人が私を助けてくれることを願っています。
ロジックを実装しないと、ajax リクエスト全体で約 200 ミリ秒かかります。