1

PHPで次のコードを使用して、 vimeo APIに従ってvimeoビデオのサムネイル(JSONから)を取得しています

    private function curl_get($url)
{
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    $return = curl_exec($curl);
    curl_close($curl);
    return $return;
}

ページをプロファイリングした後、curl_execに約220ミリ秒かかることに気付きました。これは、ビデオのサムネイルのみが必要であることを考えると、多くのことがわかります。

サムネイルを取得するより速い方法を知っていますか?

4

1 に答える 1

3

it takes to curl_exec about 220 milliseconds

It's probably the network overhead (DNS lookup - connect - transfer - fetching the transferred data). It may not be possible to speed this up any further.

Make sure you are caching the results locally, so they don't have to be fetched anew every time.

于 2012-02-22T12:02:20.047 に答える