Archived Forum Post

Index of archived forum posts

Question:

FetchSingleHeader is slower than FetchSingle

Sep 06 '13 at 11:37

I've been experiencing some (very) slow IMAP fetching. I just created a single file (with hardcoded details inside);

then I tried to FetchSingleHeader('1', true); // UID = 1 and fetching by UID. It appeared it was slower than FetchSingle('1', true); while this should be (alot) slower then just fetching the headers?

$totalHeaders = microtime(true);
for($i = 1; $i <= 100; $i++)
{
    $email = $imap->FetchSingleHeader($uid, true);
}
echo (microtime(true) - $totalHeaders); // 354 seconds

$totalFullEmail = microtime(true);
for($i = 1; $i <= 100; $i++)
{
    $email = $imap->FetchSingle($uid, true);
}
echo (microtime(true) - $totalFullEmail); // 256 seconds

// edit - see blow I've been trying to find a difference in the code or what I'm doing wrong here. When I do $email->Subject(); it return exactly the same subject in both fetches (fetchSingleHeader and fetchSingle). But when I do $email->get_Size(); the fetchSingleHeaders return a BIGGER value from exactly the same email?